【问题标题】:Changing navigation drawer icon更改导航抽屉图标
【发布时间】:2015-02-15 20:44:04
【问题描述】:

我有一个问题,我有不同背景颜色(白色或蓝色)的不同活动,而且菜单图标需要是白色或蓝色(与活动背景相反),我找不到正确的更改方法更改活动后,我该怎么做?

【问题讨论】:

    标签: android icons drawer


    【解决方案1】:

    你必须这样做:

    mDrawerToggle = new ActionBarDrawerToggle(
                this,                 
                mDrawerLayout,         
                R.drawable.ic_drawer, //<-- This is the icon provided by Google itself
                R.string.drawer_open,
                R.string.drawer_close 
                )
    

    这在setUp() 方法中。

    别忘了添加这些代码:

    @Override
    protected void onPostCreate(Bundle savedInstanceState) {
        super.onPostCreate(savedInstanceState);
        // Sync the toggle state after onRestoreInstanceState has occurred.
        mDrawerToggle.syncState();
    }
    
    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        mDrawerToggle.onConfigurationChanged(newConfig);
    }
    

    【讨论】:

    • 我没有任何设置,我有一个有更多活动的导航抽屉,但是你帮帮我吧!
    猜你喜欢
    • 1970-01-01
    • 2016-02-02
    • 1970-01-01
    • 2015-10-23
    • 1970-01-01
    • 1970-01-01
    • 2018-09-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多