简体   繁体   English

Android 5.0(Lollipop)上的菜单图标工具栏

[英]Menu icons toolbar on Android 5.0 (Lollipop)

I can't load the menu items in the toolbar. 我无法在工具栏中加载菜单项。 I'm using the Drawer Navigation, and I can't even show the hamburger icon. 我正在使用“抽屉导航”,甚至无法显示汉堡图标。

I'm using getSuportActionBar, my activity extends from ActionBarActivity, I added the toolbar xml into my activity xml. 我正在使用getSuportActionBar,我的活动是从ActionBarActivity扩展的,我将工具栏xml添加到了我的活动xml中。

SOLUTION

I found my solution here, I just added a LinearLayout as a parent in the toolbar 我在这里找到了解决方案,我只是在工具栏中添加了LinearLayout作为父项

Appcompat Toolbar Not Showing With Navigation Drawer Appcompat工具栏不与导航抽屉一起显示

You can set your favorite icon and add a listener. 您可以设置自己喜欢的图标并添加一个侦听器。

    mToolbar.setNavigationIcon(R.drawable.ic_drawer);
    mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mDrawerLayout.openDrawer(Gravity.START);
        }
    });

I found my solution here, I just added a LinearLayout as a parent in the toolbar 我在这里找到了解决方案,我只是在工具栏中添加了LinearLayout作为父项

Appcompat Toolbar Not Showing With Navigation Drawer Appcompat工具栏不与导航抽屉一起显示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM