【问题标题】:Changing the background of hamburger -> arrow button更改汉堡包的背景 -> 箭头按钮
【发布时间】:2014-12-06 23:59:31
【问题描述】:

我已经在 ActionBar 上实现了 hamburger -> 箭头按钮,就像这里:http://material-design.storage.googleapis.com/publish/v_2/material_ext_publish/0B08MbvYZK1iNWG5ldFpTU3VDd1E/animation-DelightfulDetails-DelightfulDetails-WellCrafted_v01_large_xhdpi.webm

效果很好,但是我想在按下此按钮时更改它的背景。如何更改 ActionBarDrawerToggle 的背景?

【问题讨论】:

    标签: android android-actionbar android-navigation android-toolbar


    【解决方案1】:

    以下是解决问题的解决方法,但必须有一些更好的方法:

    for(int i=0; i<( getActionBarToolbar()).getChildCount(); ++i) {
        View nextChild = getActionBarToolbar().getChildAt(i);
        if (nextChild instanceof ImageButton)
        {
            nextChild.setBackgroundResource(R.drawable.selectable_background_indigo);
        }
     }
    

    我只是在迭代并寻找显示汉堡图标的 ImageButton,但必须有一些更好的方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-07-09
      • 1970-01-01
      • 2014-10-13
      • 2015-03-02
      • 2019-09-20
      • 2015-11-20
      • 2021-09-28
      相关资源
      最近更新 更多