滚动视图中的Android列表视图自动滚动问题
我有一个android布局设置,其中有一个带有某些元素的ScrollView,而里面有一个ListView.我正在使用StackOverflow的答案 Android列表视图在滚动视图中实现此功能,并且效果很好.我的ListView在诸如TextView,ImageView之类的某些元素下面.问题是,在显示页面时,ListView会自动滚动,以使listView中的第一项位于顶部(即,整个scrollview都会滚动到呈现listview的第一项).如何避免这种自动滚动?
I have an android layout setup where I have a ScrollView with some elements and inside that I have a ListView. I am using StackOverflow's answer Android list view inside a scroll view for achieving this feature and it's working fine. My ListView is below some elements like TextView, ImageView. Problem is that when the page is presented ListView get scrolled automatically so that first item in listView is at the top (ie whole scrollview gets scrolled to present listview first item). How can I avoid this auto scrolling?
向SrollView的子级(和ListView的父级)添加android:descendantFocusability="blocksDescendants"
Add android:descendantFocusability="blocksDescendants"
to child of SrollView (and parent of ListView)