Android 支持库 23.2 - 导航抽屉 and/or 工具栏
Android Support Library 23.2 - Navigation Drawer and/or Toolbar
当我使用新的 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'
我的 Navigation Drawer 实现只是 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>
从 Toolbar
标签中删除 android:fitsSystemWindows="true"
应该会有帮助。
That’s what the default behavior of the android:fitsSystemWindows=“true” attribute gives you: it sets the padding of the View to ensure the contents don’t overlay the system windows.
上面的引述来自 Android 开发模式 blogpost。
已按要求添加评论作为答案。
当我使用新的 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'
我的 Navigation Drawer 实现只是 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>
从 Toolbar
标签中删除 android:fitsSystemWindows="true"
应该会有帮助。
That’s what the default behavior of the android:fitsSystemWindows=“true” attribute gives you: it sets the padding of the View to ensure the contents don’t overlay the system windows.
上面的引述来自 Android 开发模式 blogpost。
已按要求添加评论作为答案。