ScrollView
垂直:ScrollView
横向:HorizontalScrollView
ScrollView外层搭配RelativeLayout更灵活:
让ScrollView能Height=“match_parent”同时,above底部布局从而不会覆盖底部
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".ui.activity.ClockActivity"> <include android:id="@+id/top" layout="@layout/layout_clock_top"/> <RelativeLayout android:layout_below="@+id/top" android:layout_width="match_parent" android:layout_height="match_parent"> <ScrollView android:layout_above="@+id/fl" android:layout_width="match_parent" android:layout_height="match_parent"> <com.yanzhenjie.recyclerview.SwipeRecyclerView android:layout_above="@+id/fl" android:id="@+id/srv" android:layout_width="match_parent" android:layout_height="match_parent"/> </ScrollView> <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/fl" android:background="@color/ad_background_color" android:minHeight="185dp" android:layout_alignParentBottom="true"/> </RelativeLayout> </RelativeLayout>
上面布局意思是对的,但是理解有点问题,让RecyclerView直接above fragment也是能够不覆盖底部的