6

显示 `BottomSheetDialog 时有没有办法做 ff ?

  1. 隐藏状态栏还是BottomSheetDialog全屏?
  2. 限制 的高度BottomSheetDialog,使其不会与ActionBar

活动

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white"
    >
  <RelativeLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent">

     <include android:id="@+id/toolbar"
          layout="@layout/layout_toolbar"/>
     <!-- other UI stuff -->
</RelativeLayout>
  <ViewStub
      android:id="@+id/view_stub"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="bottom" />
</android.support.design.widget.CoordinatorLayout>

BottomSheetDialog 布局,这是在 ViewStub 中加载的

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    app:behavior_peekHeight="100dp"
    android:background="@android:color/transparent">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/share_via"
        android:layout_margin="@dimen/my_padding"/>

    <GridView
        android:id="@+id/grid"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:drawSelectorOnTop="true"
        android:listSelector="@drawable/grid_selector"
        android:stretchMode="columnWidth"
        tools:listitem="@layout/grid_item_layout" />

</LinearLayout>

展开的 BottomSheetDialog 展开的 BottomSheetDialog

窥视高度 BottomSheetDialog 窥视高度 BottomSheetDialog

隐藏的BottomSheetDialog 隐藏的BottomSheetDialog

4

0 回答 0