滚动视图中的Android列表视图自动滚动问题 [英] Android list view inside a scroll view auto scroll issue

查看:279
本文介绍了滚动视图中的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)

这篇关于滚动视图中的Android列表视图自动滚动问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆