Open ecunal opened 12 years ago
There's limited support for changing the colors at runtime. My suggestion is that you instead change the colors using a theme.
I'm already changing the background color through xml file, I use the following style for ActionBar:
`
<item name="android:layout_height">wrap_content</item>
<item name="android:paddingLeft">5dp</item>
<item name="android:paddingRight">5dp</item>
<item name="android:layout_margin">0px</item>
<item name="android:background">@color/titlebackgroundcolor</item>
</style>`
The problem is with your code where you change it from code. IIRC this is a limitation of Android, if you're using the mimic-api branch there's better support for theming that allows for separate themes on separate activities.
Alright, I was using master branch but I'll try the mimic-api one now. Thank you.
It's a bit more complex to setup but should do what you want. Take a look at the OtherActivity
in the example project of how to make use of different themes for different activities.
hmmm this seems like a really silly issue which should be easily solved. I have been looking for the piece of code that sets it to that red background. I look in everything: styles, layouts, the class files..nothing...please change it to transparent if possible...thanks..
SOLVED::
"lol this is the second issue I am solving in nearly a few hours...
If you are getting a color behind your background (most likely red), then to change the color just do something like this in the addAction function in the ActionBar.java file.
mActionsView.setBackgroundColor(Color.TRANSPARENT);"
Hi, I was using a custom background for ActionBar but when I add a custom action to my ActionBar like
actionBar.addAction(new FinishTagging());
where
FinishTagging
implementsAction
, the background of the area where the icon of this activity is shown still looks like the default one (which is red) even if I explicitly change it after the adding the activity with the statement below:actionBar.setBackgroundColor(getResources().getColor(R.color.titlebackgroundcolor));
I wonder is it a known issue or is it just my fault?
Thanks in advance.