I am trying to change the style of the text in the Actionbar Tabs. When they are stacked (below the actionbar) I want the text to be black and when they are inside the actionbar, I want the text to be white. I have customized the background successfully based on this, but cannot figure out how to do it, if it's even possible.
Related
Im making an app for android, without actionbar.
What is best practice for showing titles without actionbar?
The best practice is basically never using an action bar. This gives you a complete device screen to play with.
You can use images or different text styles for showing the title. You can also use interesting icons.
To remove action bar -
Go to res > values > styles.xml
Here is an illustration of styles file -
You can use the Toolbar (it's like the action bar, but more flexible). For example, action bar needs to be on top of the screen, but toolbar can have place anywhere in the layout.
You title can be shown as text or a beautiful asset.
If, for some reason, you don't want to use the toolbar, you can think about something like having a scrollView with the title on top of it.
Use a regular LinearLayout with a TextView inside. Style according to your needs, and set the text in the xml, or programmaticaly using TextView's setText() method.
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 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 have been trying to figure out how to make an actionbar tab menu like the one pictured below. How can I make my tabs display the icon above the text as shown here? When I implement it, it displays the icon to the left of the text. Is there something akin to the compund drawable feature of TextView (android:drawableTop) I can use for the tab?
I am using a custom XML for the Main bar, and actionbarsherlock.
that is the old android tabs view, the new ones have the text on the side next to the image
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