skaciw
skaciw

Reputation: 325

How to scroll another view based on ListView scroll

I am creating a page which contains a menu header and a PullToRefreshList.

What i want to do is to hide (scrolling) the menu header when the List is scrolled up but the menu header wont be scrolled down when the list is scrolled down (the menu header is in the original position).

What i am doing is set the page's margin whenever the listview is scrolled (using onScroll).

The application behavior is same as i wanted, but the performance is bad. the scrolling down effect is lagged so badly.

Am I doing the right way? Or, is there any better way to implement that?

Thanks.

Upvotes: 0

Views: 234

Answers (1)

Lunchbox
Lunchbox

Reputation: 1550

In your xml layout file, just enclose the part of the xml that you want to scroll in <ScrollView></ScrollView> tags. eg

<TextView
//android properties />
   <ScrollView
     //scrollview properties >
     <EditText
       //android properties />
    </ScrollView>

The EditText is scrolleble and the textview stationary

Upvotes: 1

Related Questions