Android list view inside a scroll view

后端 未结 30 2094
一向
一向 2020-11-21 13:43

I have an android layout which has a scrollView with a number of elements with in it. At the bottom of the scrollView I have a listView

30条回答
  •  执念已碎
    2020-11-21 14:03

    The shortest & easiest solution for any ChildView to scroll inside a ScrollView. Anything like ListView, RecyclerView, etc. You do not have to do anything special in code.

    Just replace ScrollView with androidx.core.widget.NestedScrollView in your current xml and then magic happens.

    Below is a sample xml code :

    
    
    
        
    
            
    
            
    
            
    
            
        
    
    

    Now you can get rid of all the ugly hacks we did to get around this nested scrolling.

    It's time to play. Hell Yeeeeeeeeeeeeeeeeeah!

提交回复
热议问题