Android BottomSheet:隐藏在工具栏下 [英] Android BottomSheet: Is hiding under the toolbar
问题描述
我尝试使用支持库23.2.0中的新底页,以使底页扩展到全屏,如
I tried to use the new bottom sheet from the support library 23.2.0 to have a bottom sheet expand to full screen like suggested in the design guidelines
这很好用,但最下面的页面位于
This works very good but the bottom sheet goes under my ActionBar and under my tabs.
如何让底页越过工具栏?我的菜单结构如下:
How is it possible to let the bottom sheet go over the toolbar? My menu is structured like this:
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|snap|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
<include
android:id="@+id/playerLayout"
layout="@layout/player_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:behavior_peekHeight="?attr/actionBarSize"
app:layout_behavior="@string/bottom_sheet_behavior"
app:model="@{model}"/>
</android.support.design.widget.CoordinatorLayout>
推荐答案
AppBarLayout
的默认标高为4dp
(维度资源值design_appbar_elevation
).
The AppBarLayout
has a default elevation of 4dp
(the dimension resource value design_appbar_elevation
).
默认情况下,CoordinatorLayout
像任何FrameLayout
一样,将在API 21和更高的设备上以较低的高度布局元素,然后以较高的高度进行布局.
By default CoordinatorLayout
, like any FrameLayout
, will layout elements with higher elevation before lower elevation on API 21 and higher devices.
尝试将android:elevation="@dimen/design_appbar_elevation"
添加到布局中.
请注意,模态底板的高度为@dimen/design_bottom_sheet_modal_elevation
== 16dp
Note that the elevation of a modal bottom sheet is @dimen/design_bottom_sheet_modal_elevation
== 16dp
这篇关于Android BottomSheet:隐藏在工具栏下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!