I have used this code to show homeupbutton in action bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
Now I want this back button to be blue or any other colour that I want. How can I do this programmatically.?
I have used this code to show homeupbutton in action bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
Now I want this back button to be blue or any other colour that I want. How can I do this programmatically.?
Here it is, to change programmatically the up carret color :
int upId = getResources().getIdentifier("up", "id", "android");
if(upId > 0)
{
ImageView up = (ImageView) findViewById(upId);
up.getDrawable().setColorFilter (Color.CYAN, PorterDuff.Mode.SRC_ATOP);
}
If you are using ABS, add this :
if (upId == 0) {
upId = R.id.abs__up;
}
You might need to do something similar if you use ActionBarCompat.
This code will also change the three lines icon if you are using the navigation drawer !