Android 上拉滑動上滑拖出pop 類似百度地圖抽屜拖拽效果
阿新 • • 發佈:2019-01-25
這裡我們用到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>