在屏幕底部展示可關閉視圖的Android控件:BottomSheet

jopen 9年前發布 | 30K 次閱讀 Android開發 移動開發 BottomSheet

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.baiduhome.net/lib/view/home/1433487385354

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!