Android ScrollView自动滑动一段距离的问题解决
16lz
2021-01-23
问题出现的原因是因为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”
便能解决问题。
更多相关文章
- android 常见布局及控件的属性详解
- Android布局动画之animateLayoutChanges与LayoutTransition
- Android布局详解
- Android一些关于分辨率和布局的设置
- android的五大布局详解
- android 使用Activity类布局时怎样让图片居中
- 创建android逐帧动画的两种方式 布局和java代码
- Android五大布局(二)——RelativeLayout、TableLayout 和AbsoulteL