简体   繁体   中英

How to fix a view on top while scrolling a view in android

Hi I have views like this

<LinearLayout ...>
     <TextView../>
     <TextView../>
     <LinearLayout> ....</LinearLayout>   
     <ScrollView...>
        <LinearLayout ...>
             <TextView..."Title"/> ---> On Scrolling the view i want to fix this 
        textview on top once this view reach top. how can i do this..?        
             <LinearLayout>....</LinearLayout>
             <TextView../>
                :
                :
         </LinearLayout..>
     </ScrollView..>

On Scrolling the view i want to fix this textview on top once this view reach top. how can i do this..?

Thanks in advance...

If you need to fix some top layout .. then firstly you need to create that layout in separate layout then you need to include same in preferred layout.

You can include layout some thing like ..

 <include layout="@layout/your_prefered_layout_to_be_fixed"/> 

Now most importantly apply scroll view with single child after including above layout.

Or simply you can apply some view in your preferred layout and then after use scroll view as mentioned above.

That's it .. You are good to go

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM