最近在github上面看到一个底部滑入控件,觉得写得挺好,所以把用法总结一下:
https://github.com/Flipboard/bottomsheet
效果图:
第1步:
在build.gradle中引用
compile ‘com.flipboard:bottomsheet-core:1.5.1’
第2步
在activity的布局activity_main.xml中
<com.flipboard.bottomsheet.BottomSheetLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/bottomSheetLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<Button
android:id="@+id/btnTest"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="测试"
/>
</LinearLayout>
</com.flipboard.bottomsheet.BottomSheetLayout>
第3步:BottomSheetLayout控件中展示的布局layout_bottom_sheet.xml
<?xml version="1.0" encoding="utf-8"?>
<