ListView下面跟着button

 
 


button随着listView的item增加而动,button始终在listView的下面, 如果满屏了,button就会固定在最底部。

代码如下:

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

    <ListView
        android:id="@+id/my_problem_listview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:scrollbars="none"/>


<Button
    android:id="@+id/btn_add"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:text="测试"/>

</LinearLayout>

无需ScrollView 就能解决。也适用于Recyclerview

猜你喜欢

转载自blog.csdn.net/u011586504/article/details/80447525