I am new to android and I created some tabs. However as bock background and text are set to black as default I cant see any text on the tabs.
How can I change the tab background or the text colour please? thanks
To change the background of your TabWidget just add in your xml file:
android:background="#b2b2b2"
Otherwise if you want to change the color of text you need to create a Custom Tab in which you can change the textcolor, font, etc.
Hope I helped you
Related
I have a view pager and have tabs at the very top. Each tab has an icon. I am not using textviews for the tabs. I've tried searching for a way to change the background color of the tabs, but all I get is solutions involving use a textview for the tabs.
Is there a way to set the background color of the tabs without using a textview? I have set icons to the tabs.
Note: The tabs will all be the same color.
This will be Awesome for you ,you can customize everything,set an icon or text or both ,change Background color and Everything
https://github.com/astuetz/PagerSlidingTabStrip
How can I change the Android StackedActionBar's Tab text color, Tab divider color, and selected navigation Tab selector color dynamically at runtime using java? I have not been able to find solutions for this without having to alter my XML each time. I have however been able to change the StackedActionBar's background color using the method for the ActionBar class:
setStackedBackgroundDrawable(Drawable drawable)
Thanks for any help in advance.
If you are adding Stacked Tabs to the Actionbar pragmatically, then you can do the styling stuff via Java. If you are declaring the Actionbar's components in XML, then you cannot highly modify the styling stuff via Java.
Here is a detailed link for dealing with Action bar.
I am using tabs in my app programatically i.e using tabspec. im not able to change the color of font of indicator the tab.
I am able to change the background color of the tab.
Create custom theme to change colors of tabs or tab indicator go to this link
http://jgilfelt.github.io/android-actionbarstylegenerator/#name=example&compat=holo&theme=light&actionbarstyle=solid&texture=0&hairline=0&backColor=E4E4E4%2C100&secondaryColor=D6D6D6%2C100&tabColor=33B5E5%2C100&tertiaryColor=F2F2F2%2C100&accentColor=33B5E5%2C100&cabBackColor=FFFFFF%2C100&cabHighlightColor=33B5E5%2C100
I want to change the colour of a tabview from the default grey (and black when not selected) to red and green when not selected.
In the tab Widget class I'm trying to set the colour using these functions
tabHost.setBackgroundColor(Color.RED);
tabHost.getTabWidget().setBackgroundColor(Color.GREEN);
But they don't work, its still the default colour. How do I manually set the background and tab colours of a tab widget in android? Also, is it possible to do it in xml?
See Step 4. at this blog, it's how I have done it, very simple, easy to change and tweak if you need to and it's all in XML.
Custom tabs in android tabhost
I changed the background color of Tab WIdget in Android. But when I changed the background, I lost the border of each Tab.
I want to change the border color of Tab Widget. How can I change it?
Is there any other way by which I can show the border?
Check my answer over here. If you need support for 1.5 it's a bit of a hack, but it'll work.