Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/183.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

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_Android Actionbar_Android Custom View_Android Navigation - Fatal编程技术网

Android导航抽屉打开/关闭抽屉上的自定义图标

Android导航抽屉打开/关闭抽屉上的自定义图标,android,android-actionbar,android-custom-view,android-navigation,Android,Android Actionbar,Android Custom View,Android Navigation,我想按以下方式自定义我的导航抽屉: 我希望在抽屉打开时显示一个图标,在抽屉关闭时显示另一个图标,而不是当前将菜单图标稍微向左滑动的默认动画 我在哪里能找到这样的想法/线索 我已经做了一些研究,能够偶然的行动栏图标,但不幸的是,这不是我要找的 难道这是不可能的吗 我猜这里应该会发生变化: mDrawerToggle = new ActionBarDrawerToggle( getActivity(), /* host Activ

我想按以下方式自定义我的导航抽屉:

我希望在抽屉打开时显示一个图标,在抽屉关闭时显示另一个图标,而不是当前将菜单图标稍微向左滑动的默认动画

我在哪里能找到这样的想法/线索

我已经做了一些研究,能够偶然的行动栏图标,但不幸的是,这不是我要找的

难道这是不可能的吗

我猜这里应该会发生变化:

mDrawerToggle = new ActionBarDrawerToggle(
                getActivity(),                    /* host Activity */
                mDrawerLayout,                    /* DrawerLayout object */
                R.drawable.ic_drawer,             /* nav drawer image to replace 'Up' caret */
                R.string.navigation_drawer_open,  /* "open drawer" description for accessibility */
                R.string.navigation_drawer_close  /* "close drawer" description for accessibility */
        )
根据我对的阅读,您需要分叉
ActionBarDrawerToggle
的实现,并将其修改为:

  • 持有两个
    Drawable
    资源ID或使用
    LevelListDrawable
    或其他东西来表示这两个状态,以及

  • 修改
    setActionBarUpIndicator()
    以考虑上面列出的更改


请注意,用户现在才开始使用“迷你汉堡”指示器,这意味着有一个导航抽屉。改变这种习惯可能会损害而不是提高应用程序的可用性。

转到这一点:这并不是我想要的,因为我正在尝试专门更改导航抽屉图标,而不是其他一些视图。无论如何谢谢你!谢谢你的CW,你似乎总是能想出最好的答案。