Change the Color of the Actionbar using Color.ParseColor

  • Antworten:1
Gelöschter Account
  • Forum-Beiträge: 1

05.12.2013, 21:27:19 via Website

Hi, i am working on a script to change the color of the actionbar.
This is the important part my script:

ActionBar bar = getActionBar();
bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#123456")));


But no matter what hex color i put into Color.parseColor(), the actionbar always changes to white.
Any idea Why?

By the way, i am new to this forum, forgive me if i posted this in the wrong forum.

— geändert am 05.12.2013, 21:49:09

Antworten
Barbaric Chicken
  • Forum-Beiträge: 66

06.12.2013, 09:04:47 via Website

Hi,

do you just need it for one activity?
Why do you try to do it programmatically?
Perhaps a xml solution would be easier.

A quick google search:
stackoverflow.com/questions/8024706/how-do-i-change-the-background-color-of-the-actionbar-of-an-actionbaractivity-us
stackoverflow.com/questions/17076958/change-actionbar-color-programmatically-more-then-once

Best regards

— geändert am 06.12.2013, 09:07:04

Antworten