How do I change the background color of the ActionBar of an ActionBarActivity using XML?

后端 未结 20 3143
我寻月下人不归
我寻月下人不归 2020-11-22 01:09

Details:

I\'m extending ActionBarActivity.
Eclipse and SDK fully patched as of 2011-11-06.



        
20条回答
  •  面向向阳花
    2020-11-22 02:01

    On the Nexus 4 people this seems to make the color go grey.

    ActionBar bar = getActionBar(); // or MainActivity.getInstance().getActionBar()
    bar.setBackgroundDrawable(new ColorDrawable(0xff00DDED));
    bar.setDisplayShowTitleEnabled(false);  // required to force redraw, without, gray color
    bar.setDisplayShowTitleEnabled(true);
    

    (all credit to this post, but it is buried in the comments, so I wanted to surface it here) https://stackoverflow.com/a/17198657/1022454

提交回复
热议问题