问题:
ScrollView内嵌套了子布局,而在更新数据后ScrollView发生自动滑动上移的情况。
此问题发生的原因:
ScrollView中子布局的的焦点的变化导致ScrollView自动的滑动 。这种情况多发生在子布局中嵌套ListView等的情况,原因是ListView抢占了ScrollView的焦点。
解决办法:
布局中添加属性,夺回焦点:
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none">
<LinearLayout
android:focusable="true"
android:focusableInTouchMode</