在屏幕底部展示可关闭视图的Android控件:BottomSheet

jopen 9年前

BottomSheet是一个Android控件,用于在屏幕底部创建一个可关闭的视图。BottomSheet适合于替代对话框和菜单,它可以容纳任何view所以应用是无止境。

FlipUI gif

Getting Started

Get started by wrapping your layout in a BottomSheet. So if you currently have this:

<LinearLayout      android:id="@+id/root"      android:orientation="vertical"      android:layout_width="match_parent"      android:layout_height="match_parent">        <View          android:id="@+id/view1"          android:layout_width="match_parent"          android:layout_height="match_parent"/>        <View          android:id="@+id/view2"          android:layout_width="match_parent"          android:layout_height="match_parent"/>    </LinearLayout>

You would have to update it to look like this:

<com.flipboard.bottomsheet.BottomSheet      android:id="@+id/bottomsheet"      android:layout_width="match_parent"      android:layout_height="match_parent">        <LinearLayout          android:id="@+id/root"          android:orientation="vertical"          android:layout_width="match_parent"          android:layout_height="match_parent">            <View              android:id="@+id/view1"              android:layout_width="match_parent"              android:layout_height="match_parent"/>            <View              android:id="@+id/view2"              android:layout_width="match_parent"              android:layout_height="match_parent"/>        </LinearLayout>    </com.flipboard.bottomsheet.BottomSheet>

项目主页:http://www.open-open.com/lib/view/home/1433487385354