右上角的抽屉式导航图标显示后退箭头图标insted的汉堡图标图标、箭头、抽屉式、insted

2023-09-06 03:41:06 作者:简 % sheet

我创建的导航抽屉的活动一个新的Andr​​oid应用程序。 当我执行的应用程序,在右上角的图标显示后退箭头,但它必须是3线的图标。

I have Create a new android app with the Navigation Drawer Activity. When i execute the app, the icon on the right corner is showing the back Arrow but it has to be the 3 line's icon.

图标R.drawable.ic_drawer是这样

The icon R.drawable.ic_drawer is this

在NavigationDrawerFragment类。

In NavigationDrawerFragment class.

// ActionBarDrawerToggle ties together the the proper interactions
    // between the navigation drawer and the action bar app icon.
    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 */
    ) 

在我执行的应用程序我得到的右箭头图标。

When i execute the App i'm getting Arrow icon on the right.

在选择同样的图标是一样的。

After the selection also the Icon is same.

我要如何改变现在呢?

推荐答案

希望这可以帮助我解决了上述问题,这种方式。 @shkschneider是正确的。为了让您的code工作导入 android.support.v7.app.ActionBarDrawerToggle

Hope this helps, I solved the above problem this way. @shkschneider is right. To make your code work import android.support.v7.app.ActionBarDrawerToggle

mDrawerToggle = new ActionBarDrawerToggle(this,
                mDrawerLayout,
                R.string.drawer_open,
                R.string.drawer_close){

            @Override
            public void onDrawerClosed(View drawerView) {
                getSupportActionBar().setTitle(mTitle);
                invalidateOptionsMenu();
            }

            @Override
            public void onDrawerOpened(View drawerView) {
                getSupportActionBar().setTitle(mDrawerTitle);
                invalidateOptionsMenu();
            }
        };