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

来源:互联网 发布:mock.js 参考文档 编辑:程序博客网 时间:2024/05/16 14:56


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>


0 0