Android renders RGB values wrong. How to fix it? - android

I have very strange problem. To explain it, I will use this simple example. I'm trying to change action bar backgroung color (or button color, it is no metter). So I use following theme, which I apply to my app.
<style name="Theme.App" parent="android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">#style/Theme.App.ActionBar</item>
</style>
<style name="Theme.App.ActionBar" parent="android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#262626</item>
<item name="android:icon">#drawable/actionbar_logo</item>
<item name="android:displayOptions">showHome</item>
<item name="android:textColor">#ffffff</item>
</style>
As you can see I use #262626 color as a background of ab. On my mockups in Adobe Photoshop and Illustrator it looks like this:
http://i.stack.imgur.com/hA7Re.png
But in my emulator (and even on my G Nexus) it looks like this:
http://i.stack.imgur.com/MBSTL.png
As you can see it uses different color. It is #212421, instead of #262626.
I'm tried to use #ff262626, tried to use 9-patch png (with the same color) as a background, but the result is the same.
I found some questions, which look like mine. Some of answers sounds like: "some Android devices do not support 32-bit png (or 16 and so on)".
So the questions are: How to fix it? How to make actionbar looks like I want? How do you create your own png-resources, which looks good? What am I doing wrong?
I would greatly appreciate for your help. Alex.
P.S. Sorry for my English:)

Related

How can I achieve something like the highlighted area below?

I have been trying to design something like this in android code but have not been able to. I have little android experience. You you be able to help me by posting the full code for how to be able to do this.
Add :
In your theme attribute:
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowContentOverlay">#null</item>
Then just put an imageview in a relativelayout and some text on and you're good to go!

ViewPageIndicator Tabs - How to achieve the following style?

I'm using ViewPageIndicator to customize the looks of the tabs in my app but I'm really new to android so I don't really know to get exactly where I want to.
Here's a gif that I made to show how I want it to behave: http://i.imgur.com/1FSw5ae.gif
I couldnt find any options to make the make the background semi-transparent like android:background_alpha or something , instead I found this topic How to make a background 20% transparent on Android but it didn't worked either.
As for the tabs switching color depending on the content I have no idea how to get there =/
If anyone could help I'd be really glad.
Here's the code for the styles:
<style name="CustomTabPageIndicator" parent="Widget.TabPageIndicator">
<item name="android:textSize">16sp</item>
<item name="android:textColor">#6abd45</item>
<item name="android:background">#80000000</item>
</style>
Thanks in advance.

What are the themes/styles used for theming the overflow dropdown menu

I am trying to theme the overflow dropdown menu but I am having trouble finding the correct themes and styles for this part of the actionbar.
I am currently looking in the following files:
https://github.com/android/platform_frameworks_base/blob/master/core/res/res/values/themes.xml
https://github.com/android/platform_frameworks_base/blob/master/core/res/res/values/styles.xml
Could anyone enlighten me please?
I managed to find what I wanted by creating a bogus holo theme here:
http://jgilfelt.github.com/android-actionbarstylegenerator/
Then I just looked at the example inside the zip file and updated my themes/styles files as so:
<item name="android:popupMenuStyle">#style/MyApp.Theme.PopupMenu</item>
<item name="android:dropDownListViewStyle">#style/MyApp.Theme.DropDownListView</item>
<style name="MyApp.Theme.PopupMenu" parent="#android:style/Widget.Holo.ListPopupWindow">
<item name="android:popupBackground">#drawable/theme_menu_popup_background</item>
</style>
<style name="MyApp.Theme.DropDownListView" parent="#android:style/Widget.Holo.ListView.DropDown">
<item name="android:listSelector">#drawable/theme_menu_popup_selector</item>
</style>
I would like to know how to totally overhaul everything but it seems I can only ever manage to drip feed my app with those essential theme/style specific bits because it takes soooo long to find the necessary styling syntax. If only there was an easier way.
Of course I have no idea how to position the ListPopupWindow or even change the color of the text but it's good enough for now.

How to change style from code? Want to achieve skins

How to change a style from code?
I got a style used all across my app, for all buttons. If the user changes the skin of the app, the background of this style should change.
<style name="ActionBtn">
<item name="android:layout_width">#dimen/action_btn_width</item>
<item name="android:layout_height">#dimen/action_btn_height</item>
<item name="android:background">#drawable/btn_frame_bgstate</item>
<item name="android:padding">#dimen/action_btn_padding</item>
<item name="android:layout_margin">#dimen/action_btn_margin</item>
</style>
So far the only idea I got is to make a custom button that itself chooses its background on creation.
I have not found any good, generic way for skinning android apps yet, but if I could change styles from code, that would do the trick.
All suggestions welcome!
1) Create different themes for your skins.
2) Set those themes programatically using following code in your onCreate method.
setTheme(resid);
resid is the id of your theme.

Android 3.0 ActionBar, changing colors

How can I change the color of the underline beneath the tabs? It's currently the light blue, and I can't find any resources on how to change this for Android 3.0.
Additionally, I'd like to change the text color for the menu items that show up on the right of the ActionBar as a result of: android:showAsAction="ifRoom|withText"
Anyone know how to change these?
You can control the appearance of the tabs by using the properties android:actionBarTabStyle, android:actionBarTabBarStyle, and android:actionBarTabTextStyle.
This section in the official developer guide shows a sample xml to customize the action bar's style.
Regarding the text of the menu options check the properties actionMenuTextAppearance and actionMenuTextColor.
As additional info, here's how I found out how to change the blue bar below each tab (the answer above is perfectly good, but I lacked little information that I put here, which might be useful to somebody).
You just need to change the background to a 9 patch drawable.
Here's how it looks like:
http://android-developers.blogspot.com/2011/04/customizing-action-bar.html
Source available here:
http://code.google.com/p/styled-action-bar/source/browse/trunk/res/drawable/actionbar_tab_bg.xml
9 patches available here:
http://code.google.com/p/styled-action-bar/source/browse/trunk/res/drawable-mdpi
I know this was really easy, but again, it might be useful so I'm just dropping the links here.
None of these solutions worked for me. I changed the colors of my tabs as follows:
This is in the themes.xml
<style name="MyApp" parent="android:style/Theme.Holo">
<item name="android:actionBarTabTextStyle">#style/MyApp.ActionBar.MyTabStyle</item>
</style>
This is in styles.xml
<style name="MyApp.ActionBar.MyTabStyle" parent="android:style/Widget.Holo.ActionBarView_TabText">
<item name="android:textColor">#00ff00</item>
</style>
This should make your tabs green.
I think that you can use:
<resources>
<style name="MyTheme" parent="android:style/Theme.Holo.Light">
<item name="android:actionMenuTextColor">#color/...</item>
</style>
</resources>
Regards

Categories

Resources