阅读背景:

Toolbar menu遇到的问题_u011062800的博客

来源:互联网 

图标和文字同时显示

  @SuppressLint("RestrictedApi")
    private fun initMenu() {
        var menu = toolbar?.getMenu()
        if (menu is MenuBuilder) {
            //设置图标文字同时显示
            menu.setOptionalIconsVisible(true)
        }
        //设置右边更多按钮(三个点)为黑色
        var moreIcon = ContextCompat.getDrawable(this, R.drawable.abc_ic_menu_overflow_material);
        if(moreIcon != null) {
            moreIcon.setColorFilter(ContextCompat.getColor(this, R.color.color_black), PorterDuff.Mode.SRC_ATOP)
            toolbar?.setOverflowIcon(moreIcon)
        }
    }  @SuppressLint("RestrictedApi")
  



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: