How to change home as up resource programmatically?

前端 未结 6 1660
迷失自我
迷失自我 2020-12-25 15:02

I know how to change the homeAsUpIndicator in the styles xml file. The question is how to change it programmatically.

The reason I want to do it bec

6条回答
  •  無奈伤痛
    2020-12-25 15:24

    Here is working code

    final Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_black_24dp);
            upArrow.setColorFilter(Color.parseColor("#000000"), PorterDuff.Mode.SRC_ATOP);
            getSupportActionBar().setHomeAsUpIndicator(upArrow);
    

提交回复
热议问题