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.
Related
Is there an easy way to change the colour of the horizontal line that appears
when the TAB is active?
Usually it appears as Green... I use Edit Default Style to change the colour to blue/red when Text is active, but I could not find an equivalent for the Green Horizontal line?
(if can't see above Image, see
Is the Green an android / windows / Delphi default? I see some images with green shapes inside the Edit Default Style properties...
Can the Green horizontal line be changed to blue/red easily?
Can the Green horizontal line be disabled (set Invisible) easily without disabling the Active/non-active feature of the Tab text? I suppose I can set the Tab text to non-styled, and then manually change the colour of the Tab Text... but will be less elegant
Thanks for any input. I've checked the web for any link I can find (including How to change the color of active TAB in a TabControl, in Delphi)
The style used to paint the bottom line in the tabitems is TabItemStyle.Top.ActiveLink
You can use the style designer to change which rectangle is used for ActiveLink. For instance, you could click on this property to bring up the bitmaplinks editor, and then drag the rectangle so that the bottom line is not part of ActiveLink, and then your colored line is not drawn.
I have a menu, with several buttons and its drawables. This menu is included in 4 activitys.
I am setting the drawable color programmatically:
mDrawable.setColorFilter (0xff0099cc, PorterDuff.Mode.SRC_IN);
The first button by default is enabled, so the color is changed programmatically. When I press another button to go to another activity, the other button changes the color, but the first one remains as if it had activated.
You are not clear about your drawable and so I ll give generic solution to you.
You can just use Drawable.setColorFilter( 0xffff0000, Mode.MULTIPLY ). If you could make the entire image WHITE (FFFFFF) so that when you do PorterDuff.Mode.MULTIPLY, you end up with the correct colors. Note this would not affect the transparent pixels.
For solid images, it is best to use the color filter PorterDuff.Mode.SRC_ATOP because it will overlay the color on top of the source image, allowing you to change the color to the exact color you are looking for.
Let me know, whether it helps.
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.
On Android ICS you get the standard blue highlight color for all user controls, you get this on elements like textviews, highlights on buttons, indications on the end of a scrollview and tabwidgets.
Is there a way to change all the color's at once using a theme?
Thanks in advance!
Cheers!
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