这里我们用到GitHub上个一个开源库:https://github.com/yingLanNull/ScrollLayout
先看效果图
大概就是这样的一个效果,这个库功能非常多,感谢前辈们的贡献!
--------------------------------------手动分割----------------------------------------------------------------.
首先添加依赖
compile 'com.yinglan.scrolllayout:scrolllayout:1.0.2'
开始写布局,我这个布局就一个Button其他的都是这个控件所需要的
activity.xml
-
<RelativeLayout
-
xmlns:android="http://schemas.android.com/apk/res/android"
-
xmlns:tools="http://schemas.android.com/tools"
-
android:id="@+id/root"
-
android:layout_width="match_parent"
-
android:layout_height="match_parent"
-
tools:context=".MainActivity">
-
<com.yinglan.scrolllayout.ScrollLayout
-
android:id="@+id/scroll_down_layout"
-
android:layout_width="match_parent"
-
android:layout_height="match_parent"
-
android:background="#000000"
-
>
-
<RelativeLayout
-
android:layout_width="match_parent"
-
android:layout_height="match_parent">
-
<com.yinglan.scrolllayout.content.ContentListView
-
android:id="@+id/list_view"
-
android:layout_width="match_parent"
-
android:layout_height="match_parent"
-
android:background="@android:color/white"
-
></com.yinglan.scrolllayout.content.ContentListView>
-
<TextView
-
android:id="@+id/text_foot"
-
android:layout_width="match_parent"
-
android:layout_height="50dp"
-
android:background="@color/colorPrimaryDark"
-
android:clickable="true"
-
android:gravity="center"
-
android:text="点击或上滑打开" />
-
</RelativeLayout>
-
</com.yinglan.scrolllayout.ScrollLayout>
-
<Button
-
android:id="@+id/test_bt"
-
android:layout_width="wrap_content"
-
android:layout_height="wrap_content"
-
android:text="测试按钮"
-
/>
-
</RelativeLayout>