问题描述
更新:我发现从谷歌的github上的汉堡包图标(https://github.com/google/material-design-icons/blob/master/navigation/drawable-xxhdpi/ic_menu_white_48dp.png)不过将绘制资源到ActionBarDrawerToggle并调用syncState不显示图标汉堡包相反其他职位的建议(Appcompatv7 - V21导航抽屉里不显示图标汉堡)
UPDATE: I have found the hamburger icon from google's github (https://github.com/google/material-design-icons/blob/master/navigation/drawable-xxhdpi/ic_menu_white_48dp.png) but passing the drawable resource to the ActionBarDrawerToggle and calling syncState doesn't show the hamburger icon contrary to other post's suggestions (Appcompatv7 - v21 Navigation drawer not showing hamburger icon)
老问题:我是在导航栏为我的Android应用程序,我意识到,汉堡包图标不见了。我跟着这个问题(Appcompatv7 - V21导航抽屉里不显示图标汉堡),并意识到,我必须调用 mDrawerToggle.syncState();
...现在创建一个 ActionBarDrawerToggle
类,我需要以下内容:
OLD QUESTION: I was making a navigation bar for my android app and I realized that the hamburger icon was missing. I followed this question (Appcompatv7 - v21 Navigation drawer not showing hamburger icon) and realized that I must call a mDrawerToggle.syncState();
... Now to create an ActionBarDrawerToggle
class I need the following:
- 活动 - 举办抽屉的活动
- drawerLayout - 该DrawerLayout链接到指定的活动的动作条
- drawerImageRes - 可绘制资源的抽屉指标使用
- openDrawerContentDescRes - 字符串资源来形容打开的抽屉 - 可访问性行动
- closeDrawerContentDescRes - 一个字符串资源来描述无障碍关闭抽屉行动
我这个
作为活动(我打电话这从我的主要活动),drawerLayout因为我的实际抽屉布局和文档并没有真正解释什么传递最后两个参数做,我只是创建了一些占位符字符串资源和通过他们,但我不明白,drawerImageRes需要展现汉堡图标,我只是不知道从哪里得到它的形式。
I passed in this
as the activity (I'm calling this from my main activity), drawerLayout as my actual drawer layout and the docs weren't really explaining what the last two params do so I just created some placeholder string resources and passed them in. But I do understand that the drawerImageRes is required to show the hamburger icon, I just don't know where to get it form..
谁能告诉我在哪儿能买到汉堡包图标?
Can anyone tell me where I can get the hamburger icon?
编辑:
我想通了,从Android例如使用 R.drawable.ic_drawer
,但我不知道它的来自... Android的开发者网站还说:
I figured out that the android example from https://developer.android.com/training/implementing-navigation/nav-drawer.html uses R.drawable.ic_drawer
but I don't know where it's come from... The android developer website also says:
标准的抽屉式导航栏图标,在下载操作栏图标包是可用的。
但我下载的包和棒棒糖汉堡包是不是有...
But I downloaded the pack and the lollipop hamburger isn't there...
推荐答案
如果您更新您的支持库V22,以及
If you update your support library to v22, and
mDrawerToggle = new ActionBarDrawerToggle(
getActivity(), /* host Activity */
mDrawerLayout, /* DrawerLayout object */
R.string.navigation_drawer_open, /* "open drawer" description for accessibility */
R.string.navigation_drawer_close /* "close drawer" description for accessibility */
)
做一些类似的,汉堡包图标会显示出来。我有一个类似的问题,但现在它的固定多亏了真正有用的人。
do something similar to this, the hamburger icon will show up. I had a problem similar to this but now it's fixed thanks to a really helpful person.
这篇关于ActionBarDrawerToggle.syncState不显示图标汉堡包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!