Android 否";“汉堡包”;从片段设置工具栏时抽屉布局的图标
我正在使用Android设计支持库获取导航抽屉模式。我有以下主要活动布局:Android 否";“汉堡包”;从片段设置工具栏时抽屉布局的图标,android,material-design,androiddesignsupport,Android,Material Design,Androiddesignsupport,我正在使用Android设计支持库获取导航抽屉模式。我有以下主要活动布局: <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res/pl.dzieli
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res/pl.dzielins42.skinflint.android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="http://schemas.android.com/apk/res-auto"
tools:ignore="MergeRootFrame" >
<!-- The main content view -->
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- The navigation drawer -->
<android.support.design.widget.NavigationView
android:id="@+id/drawer_navigation_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/view_nav_drawer_header"
app:menu="@menu/drawer" />
</android.support.v4.widget.DrawerLayout>
问题在于,在第一个片段(在活动的onCreate
中膨胀)上,“汉堡包”图标正确显示,但在我使用工具栏将片段更改为另一个片段后,图标变为标准的后退箭头
我试图通过使用ActionBarDrawerToggle
(v7)并在onDrawerClosed
中调用syncState
来修复它。这部分修复了它,因为“汉堡包”图标已设置,但只有在抽屉完全关闭后,所以当它仍在关闭时,返回箭头图标才可见
有人能提供更好的解决方案吗?正确设置ActionBarDrawerToggle
:
mDrawerToggle.setDrawerIndicatorEnabled(true);
正确设置ActionBarDrawerToggle
:
mDrawerToggle.setDrawerIndicatorEnabled(true);