【发布时间】:2015-11-12 04:30:20
【问题描述】:
我目前有一个带有标题的工具栏的导航抽屉,我希望将这个标题放在工具栏中,但工具栏似乎没有考虑到抽屉图标,如下图所示。
而当我对不在导航抽屉内的其他活动使用相同的工具栏布局时,标题完美居中,如下图所示:
那么我如何让它考虑到这个图标呢?
这是我的布局:
<android.support.design.widget.AppBarLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:theme="@style/Theme.App.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/black"
app:popupTheme="@style/Theme.App.PopupOverlay">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textColor="@color/white"
android:textStyle="bold"
android:text="Title"
android:textSize="16sp" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
【问题讨论】:
标签: android android-toolbar navigation-drawer