美文网首页
ScrollView嵌套listview时,会发现界面自动上移,

ScrollView嵌套listview时,会发现界面自动上移,

作者: 程序猿的小生活 | 来源:发表于2019-11-25 17:21 被阅读0次

1.在listview的父布局加入以下属性

 android:descendantFocusability="blocksDescendants"

2.举例说明

  <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">
 <LinearLayout
            android:descendantFocusability="blocksDescendants"
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

    <app.goa.com.ydbgnew.utils.MyListView
        android:paddingBottom="10dp"
        android:paddingLeft="15dp"
        android:divider="@null"
        android:id="@+id/fujian"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"></app.goa.com.ydbgnew.utils.MyListView>
        </LinearLayout>
</ScrollView>

相关文章

网友评论

      本文标题:ScrollView嵌套listview时,会发现界面自动上移,

      本文链接:https://www.haomeiwen.com/subject/nsujwctx.html