我有一個應用程序佈局,自定義toolbar
和持久BottomSheet
- 都在CoordinatorLayout
內。我想要顯示BottomSheet
。此時表單全屏顯示並覆蓋toolbar
。通過將應用程序主題設置爲保持低於ActionBar
,但酒吧不能定製。ActionBar下面的持久底片
有沒有一種方法來限制persit的高度BottomSheet
爲全屏 - ActionBar
高度?
這是我在activity_main.xml
<android.support.design.widget.CoordinatorLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:attrs="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.test.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
app:elevation="20dp"
android:elevation="20dp"
android:layout_height="?attr/actionBarSize">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
app:elevation="20dp"
android:elevation="20dp"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"/>
</android.support.design.widget.AppBarLayout>
</LinearLayout>
<include layout="@layout/bottom_sheet_additem"/>
</CoordinatorLayout>
代碼以下爲sheet_bottom.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/bottomSheetLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorAccent"
app:behavior_hideable="true"
app:behavior_peekHeight="0dp"
android:fitsSystemWindows="true"
app:layout_behavior="@string/bottom_sheet_behavior">
<TextView
android:id="@+id/bottomsheet_text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Lorem Ipsum Dolor..."
android:textColor="#FFFFFF" />
</RelativeLayout>
在左手側上的圖像的代碼示出了停止Toolbar
低於BottomSheet
- 這是沒有使用我當前的代碼。目前它看起來像右邊的圖片。
你可以上傳截圖? –
截圖添加到問題 - 編輯 – nor0x
你怎麼樣嘗試把它的高度從底部設置到工具欄,並使底部底片它的孩子,然後將其設置爲匹配它的父母高度(新佈局) –