Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 否";“汉堡包”;从片段设置工具栏时抽屉布局的图标_Android_Material Design_Androiddesignsupport - Fatal编程技术网

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设计支持库获取导航抽屉模式。我有以下主要活动布局:

<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);