您的位置:首页 > 其它

ScrollView内的控件改变之后自动滚动的问题

2015-06-25 13:15 495 查看
ScrollView中控件的长度发生改变,这时ScrollView会自动下滚到变化的控件处。滚动的那一下体验特别不好,所以要防止这种情况。

<ScrollView
android:id="@+id/scroll"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:focusable="true"
android:focusableInTouchMode="true" >

 <!-- 上面这两行是控制scrollview
android:focusable="true"
android:focusableInTouchMode="true"
不自动的关键! !-->

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<!-- GridView高度可变  -->
<GridView
                      android:id="@+id/gridView"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:horizontalSpacing="@dimen/gridview_spacing"
                      android:numColumns="3"
                      android:verticalSpacing="@dimen/gridview_spacing" />

</LinearLayout>
</LinearLayout>
</ScrollView>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: