How to change home as up resource programmatically?

前端 未结 6 1662
迷失自我
迷失自我 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:29

    int upId = Resources.getSystem().getIdentifier("up", "id", "android");
    if (upId > 0) {
        ImageView up = (ImageView) findViewById(upId);
        up.setImageResource(R.drawable.ic_drawer_indicator);
    }
    

提交回复
热议问题