为什么android工具栏高度被削减?

Raj*_*jat 5 android toolbar android-layout android-studio

我是最新的android studio中的设计模式的新手,带有include标签的那个.我试过调整文件但最后是剪切工具栏.

第一项活动

在此输入图像描述

first_activity.xml

 <?xml version="1.0" encoding="utf-8"?>

 <LinearLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_height="match_parent" android:layout_width="match_parent"
 android:orientation="vertical">

   <include layout="@layout/app_bar_main" android:layout_width="match_parent"
    android:layout_height="wrap_content" />

  <android.support.v4.widget.DrawerLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:app="http://schemas.android.com/apk/res-auto"
 xmlns:tools="http://schemas.android.com/tools"
 android:id="@+id/drawer_layout"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:fitsSystemWindows="true"
 tools:openDrawer="start">

 <!-- Framelayout to display Fragments -->
 <FrameLayout
     android:id="@+id/frame_container"
     android:layout_width="match_parent"
     android:layout_height="match_parent" />

 <!-- Listview to display slider menu -->
 <ListView
     android:id="@+id/main_nav_drawer"
     android:layout_width="240dp"
     android:layout_height="match_parent"
     android:layout_gravity="start"
     android:choiceMode="singleChoice"
     android:divider="#888"
     android:dividerHeight="1dp"
     android:background="#fff"/>
     <!--android:listSelector="@drawable/list_selector"-->
      </android.support.v4.widget.DrawerLayout> </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

这是我的应用栏布局.

app_bar_main.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".Activities.MainActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:theme="@style/AppTheme.AppBarOverlay">
        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay"/>

    </android.support.design.widget.AppBarLayout>


</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

Dan*_*nai 8

以这种方式更改工具栏XML:

<android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minHeight="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/AppTheme.PopupOverlay"/>
Run Code Online (Sandbox Code Playgroud)

请注意,minHeight不允许较小的尺寸,wrap_content现在高度允许更大的工具栏.