Selected tab background color (ActionBarSherlock) - android

I have three tabs (ActionBarSherlock) and by default there is a small indicator which is blue. What I want is to change so that the selected tab is red, i.e. not only the indicator but the whole tab.
Is that possible? I have tried some suggested solutions without luck.

Related

How to make the title bar change color when the tab is changed

If I am on a tab in a tabbed activity, and I change tabs, how do I make the title bar and tab indicator change colors? An example of what I'm talking about can be seen below (done on paint).
App bar changing color when different tabs are selected
I figure that manipulating the different elements and what color resources that they use could be done to change everything uniformly, but at the same time, I don't know how to do that. I have four tabs, and four sets of colors picked from the material design library, red, blue, green and yellow. Including red dark, blue dark, etc.
I'm not using the default tab layout activity that comes with android studio, instead, I am using one similar to the one used here
https://androidbelieve.com/navigation-drawer-with-swipe-tabs-using-design-support-library/
minus the navigation drawer. All help would be sincerely appreciated, though I'm afraid that I'm still quite a beginner so I would appreciate it if you could make it as simple as possible.
:D
You can just right code according to selected tab position
for tab 1
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#F00")));
for tab 2
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#FF0")));
for tab 3
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#F0F")));
I use
getWindow().setStatusBarColor(color);
for change color title bar.

How to set the background color of an Android tab?

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

Font color in tab indicator

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

Different background for each actionbar tab

In my app I've got three tabs in an actionbar (using ActionBarSherlock). In an xml
style I set/overwrite default background selector and everything works well. But... now I've got to set individual backgrounds for each tab. Visually I want to have my tabs with different underline color.
Ideally I'd like to have something like this:
Tab t = actionBar.newTab();
t.setBackground(...);
actionBar.addTab(t);
But there is no method setBackground.
So, I created a custom view for the tabs and now I have this:
The first problem is the size. I'd like to have exactly the same size I had with standard/default tabs.
The second problem is the background selector doesn't work. When I press a not selected tab it doesn't change its state/background, and it is the same selector that works perfectly with TabView.background.
What I'd like to have exactly is standard actionbar tabs with different background selector for each tab. Any ideas?

How do I set the color for a tabview in android?

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

Categories

Resources