我已使用此代码在操作栏中显示 homeupbutton。
getActionBar().setDisplayHomeAsUpEnabled(true);
现在我希望这个后退按钮是蓝色或我想要的任何其他颜色。我怎样才能以编程方式做到这一点。?
我已使用此代码在操作栏中显示 homeupbutton。
getActionBar().setDisplayHomeAsUpEnabled(true);
现在我希望这个后退按钮是蓝色或我想要的任何其他颜色。我怎样才能以编程方式做到这一点。?
在这里,以编程方式更改 up carret 颜色:
int upId = getResources().getIdentifier("up", "id", "android");
if(upId > 0)
{
ImageView up = (ImageView) findViewById(upId);
up.getDrawable().setColorFilter (Color.CYAN, PorterDuff.Mode.SRC_ATOP);
}
如果您使用的是 ABS,请添加:
if (upId == 0) {
upId = R.id.abs__up;
}
如果您使用 ActionBarCompat,您可能需要做类似的事情。
如果您使用导航抽屉,此代码还将更改三行图标!