BottomNavigationBar - how to change the colour - android

The source of this component is :
https://github.com/pocheshire/BottomNavigationBar
I have a bottom navigation bar in an Android App with 4 tabs on.
I want to set the background colour to be the same regardless of selected tab
I want to show icon + text for all tab buttons regardless of whether they are selected or not.
The background colour defaults to White. The only way I can find to change it is to call setActiveTabColor() for each Tab. This works but seems like overkill I should only need to set it in one place.
However the real problem is as follows :
I cannot show the text for all icons unless I call useFixedMode();
However once useFixedMode() is called, SetActiveTabColor no longer works and the I cannot then set the background colour - it defaults to white.
I have also tried SetBackgroundColor(); to no effect
What am I missing ?

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 match the menu bar/notification bar color match application

I have an Android app which allows the user to change the color of a background based on the selection they choose.
This is the line that changes the color:
appBackground.setBackgroundColor(Color.rgb(inRed, inGreen, inBlue));
How do I also change the menu bar color as well the notification bar to change to that color of the user's choice?
I know it's only possible in KitKat but can someone point me to the way...
If you would like an effect like the image below, have a look here:
Why can't we use a Translucent system bars with and ActionBar
As you can see, the background color can be changed programatically (so it's not defined in the xml).

Override list item background color with white, keep system default (long)pressed color

How can I replace the color of a listview item background when in the non-(focused|pressed|activated) state with a custom color, but keep all the system default colors for pressed, long-pressed, activated, focused etc. states?
I'm trying to give my listviews a card style - that is white items with space in between on a grey background (as in Google Play Store app and others).
So I want to give the items a white background, but at the same time, keep all the system default selectors, including the fade animation for long press. That is, I want to replace the transparent color for the inactive states with white, but keep all the other states as by default.
This is even more important since the KitKat release, because all the accents have now switched from blue to grey, so I would like the app to respect that - to have blue color when pressed on ICS and JellyBean, but grey on KitKat. Therefore, I don't want to hard-code any values into a custom selector.
All right, I figured it out and it's incredibly simple:
All I have to do is to add this attribute to the given ListView:
android:drawSelectorOnTop="true"
And that's all! I can give the list items any background color that I want and it will always be overlayed by the system default selector!

Android: use dark ExpandableListView icon?

My app uses Theme.Holo. When I instantiate an ExpandableListView, it uses white icons for the group rows. (in the image, the icon is visible in the first row because I am pressing this row to highlight it, the other rows have invisibly white icons).
I know I can set the group icon with ExpandableListView.setGroupIndicator(), but I would rather specify to use a dark version of the OS icon, if this is possible?
You will need to change the default group indicator in this case. A light or dark indicator are just different icons anyway. Without changing the theme, the only way is to change the icons/drawables for the indicator.

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