i recently customized the UI of my tabs by setting a backgroundResource on each tab, then switch between selected / unselected depending on which tab is currently in focus. I got one problem though, there seems to be a white border that comes with the tabwidget by default that stretches over to the other (unselected) tabs at the bottom. I wanna change the color or possibly remove it. Is there anyway of doing that ?
//thx in advance for replies
Related
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.
I have a tablayout in fragment which has its colors predefined in the xml. When the fragment is initialised, the tablayout shows the right color.
However in certain devices (Especially api 21 and above), the tablayout changes its color to white without any reason when some action happens in the fragment. I am nowhere touching the tablayout color through my code. Can someone explain why. Also, I noticed when keyboard comes up in the fragment for any user action, the tab layout color changes to white. Can activity resizing be a cause of this ? It seems when keyboard comes up, the tablayout background color seems to go away as if it has moved up or something.
My Home with tab layout.
I resolved this issue by setting tablayout drawable xml's for selected and unselected states instead of using just background color from resources
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
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.