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

Android ScrollView嵌套GridView或者ListView的时候,页面自动滚动到GridView或者ListView所在位置的问题

2017-09-30 15:26 671 查看
布局文件:

<ScrollView
android:id="@+id/ptrsl"
android:layout_width="match_parent"
android:layout_height="match_parent">

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

<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:src="@drawable/mz8"/>

<com.jd.jdvip.widget.GridViewForScrollView
android:id="@+id/benefit_gv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:horizontalSpacing="5dp"
android:numColumns="2"
android:overScrollMode="never"
android:verticalSpacing="5dp">

</com.jd.jdvip.widget.GridViewForScrollView>

</LinearLayout>
</ScrollView>


解决办法:在ScrollView的子布局LinearLayout加上属性

android:focusable="true"
android:focusableInTouchMode="true"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android scrollview
相关文章推荐