Editing the underbar on a tab in Android - android

Hey guys I am newer to Android development and I am trying to to figure out how to edit the underbar that is on the tabs when one is selected. I have this:
<item name="android:actionBarTabBarStyle">#style/Theme.test.tabbar.style</item>
Which points here:
<style name="Theme.test.tabbar.style" parent="#android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#color/black</item>
<item name="android:actionBarItemBackground">#color/yellow</item>
</style>
This works great except the android:actionBarItemBackground So I was wondering what do I need to point to in order to edit the active bar that shows underneath a tab you are active on?
David

Create a custom theme using this online services and then aplly the theme (remember to copy all the resources in your project!)
http://android-ui-utils.googlecode.com/hg/asset-studio/dist/index.html

Related

android 4.2 how to get main color of current theme

In android 4.2 we have the possibility to select theme in device settings.
Default theme is equivalent to using #android:color/holo_blue_light as main color.
The question is what tag to use in order to get main color (blue_light, mint, mocha, raspberry) in my own style? If I use #android:color/holo_blue_light, when user switches to mint, part of user interface is in mint color (parts not modified by myself) and part in blue_light (parts modified by myself). I spent many many hours and it's seems there is no any solution.... Perhaps any workaround....?
I even tried to analyse Android styles and theme sources and still no answer:
https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/res/res/values/styles.xml
https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/res/res/values/themes.xml
At the end I'm posting part of my style code (on the request of one users here):
<style name="MyActionBarStyle" parent="#android:style/Widget.Holo.ActionBar">
<item name="android:displayOptions">showHome</item>
<item name="android:background">#android:color/holo_blue_light</item>
<item name="android:backgroundStacked">#android:color/holo_blue_light</item>
<item name="android:backgroundSplit">#android:color/holo_blue_light</item>
</style>
Instead of using #android:color/holo_blue_light i should use probably something like #android:color/holo_main_color but the problem is it seems not to exist.

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