您的位置:首页 > 移动开发 > Android开发

Android ScrollView自动滑动一段距离的问题解决

2015-12-01 17:38 447 查看
问题出现的原因是因为ScrollView中子布局的的焦点的变化导致ScrollView自动的滑动 。所以解决方法就是让ScrollView中的最外层子布局焦点固定。

<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:focusable="true"
android:focusableInTouchMode="true">
</LinearLayout>
</ScrollView>


在LinearLayout中加入

android:focusable=”true”

android:focusableInTouchMode=”true”

便能解决问题。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息