Android支持库23.2 - 导航抽屉和/或工具栏

时间:2016-02-25 15:18:16

标签: android android-studio android-support-library

当我使用新的Android支持库23.2(特别是com.android.support:design:23.2.0)时,导航抽屉的Android Studio实现中使用的工具栏会按下图标和标题。看看:

With 'com.android.support:design:23.1.1'

With 'com.android.support:design:23.2.0'

我的导航抽屉实现只是Android Studio生成的,没有自定义更改。

任何线索如何解决这个问题?

提前致谢!

更新

工具栏资源文件(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="net.sqoops.sqoops.activity.TimelineActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        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:fitsSystemWindows="true"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay" />

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

    <include layout="@layout/content_timeline"/>

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

1 个答案:

答案 0 :(得分:3)

android:fitsSystemWindows="true"代码中删除Toolbar应该会有所帮助。

  

这就是android:fitsSystemWindows =“true”属性的默认行为给出的:它设置View的填充以确保内容不会覆盖系统窗口。

以上引用来自Android开发模式之一blogpost

根据要求添加评论作为答案。