如何调整android中棒棒糖设备工具栏的高度

时间:2015-10-15 06:36:43

标签: android

我在我的应用中使用工具栏。工具栏的高度可以在棒棒糖前设备中正确调整,但是棒棒糖设备从底部切割工具栏意味着没有完全显示。请帮帮我。

工具栏的Xml代码是:

<android.support.v4.widget.DrawerLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawerMainActivity"
android:layout_width="match_parent"
android:layout_height="match_parent">

<FrameLayout
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/containerView">

    <android.support.v7.widget.Toolbar
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="?android:attr/actionBarSize"
        android:gravity="center"
        android:minHeight="?android:attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:navigationIcon="@drawable/save"
        android:id="@+id/toolBar"
        android:theme="@style/ThemeOverlay.AppCompat.Dark"
    android:fitsSystemWindows="true"/>


</FrameLayout>

<android.support.v7.widget.RecyclerView
    android:layout_width="217dp"
    android:layout_height="match_parent"
    android:id="@+id/recyclerView"
    android:scrollbars="vertical"
    android:background="#ffffff"
    android:layout_gravity="left" />

2 个答案:

答案 0 :(得分:1)

我猜你在使用AppCompat?然后将height的属性更改为:

android:layout_height="?attr/actionBarSize"

并在FrameLayout上设置android:fitsSystemWindows="true"

答案 1 :(得分:0)

您可以在此处找到解决方案:

Toolbar behind status bar

希望它对你有所帮助!! :)