I'm using new Navigation Component in my project. I created a custom Toolbar which will keep the Title in the centre even when having navigation drawer.
This is how my toolbar looks now.
I'm trying to put a custom hamburger and back icon there(basically i need white icons).
I've tried
dataBinding.appBarHome.toolbar.setNavigationIcon(ContextCompat.getDrawable(this, R.drawable.ic_hamburger));
getSupportActionBar().setHomeAsUpIndicator(ContextCompat.getDrawable(this,R.drawable.ic_hamburger));
None of it is working. if want to see any specific part of my code, feel free to ask.
Maybe it just because of style or them,
Just try with bellow style
ThemeOverlay.AppCompat.Dark.ActionBar
When every you choose dark action bar then default icon color should be white and when you select an action bar then it will be the black icon
So just replace style in your manifest or style.xml
Related
I want to add title under the icon that as default appears when i create the navigation drawer .
like in red border
Its not possible if you use normal ActionBarToggle, you can provide your own custom layout in toolbar and add menu icon to it but back animation will not work. Also you will have to handle click events on the menu your self
I'm trying to change the color of the on screen button bar:
I've managed to change the status bar color via the Android Manifest like this:
android:theme="#style/Theme.WebViewApp.Gray"
However I can't seem to figure out how to change from this purple color.
This section of screen called NavigationBar:
You can change color of NavigationBar using: http://developer.android.com/reference/android/view/Window.html#setNavigationBarColor(int)
This Method won't work on API version < 21.
To change navigation bar icon colors you can use the following answers: Change navigation bar icon color on Android
I am trying to custom our home as up indicator on our Android ActionBar. I have change the icon and padding using theme style.
<item name="android:homeAsUpIndicator">#drawable/fb_back</item>
While this make the function
getActionBar().setDisplayHomeAsUpEnabled(false);
become useless. Because in some situation I want to hide the up arrow icon. However calling this leaves large space left of the home button. I am working on sdk 16, so I cannot dynamically set the homeAsUp indicator using
getActionBar().setHomeAsUpIndicator
Some one know a better solution to do this?
I want to customize navigation drawer app compact action bar, I want to remove app icon from that and want to make its title center in action bar.
I have applied all solutions , but nothing is working with all the conditions.
Please give me some clue for applying it correctly
You should creat a customize action bar. Then, if you want you can add a button that can open and close your drawerlayout.
I have solved my problem. As mentioned, I have two problems, and I solved that in following way :
1) For making title centre, we need to make custom layout of action bar, and need to remove action bar title.
2) for remove app icon from action bar, we need to set android:icon property of that activity in manifest with transparent image or colour.
I am using the ActionBarCompat sample. If our action bar has a dark background, we want to use white-colored icons. But these icons are also used for the system menu items (when they don't fit on the action bar, pre-honeycomb). So the white icons aren't visible on the system menu white background. Example:
What can we do about this? Is there a way to use the dark version of icons when shown on the system menu, and light colored when on the action bar?
Thanks
There are only two ways to handle this issue. Either change the color of your ActionBar, or edit the color of your icons.
I would suggest that best combination for Actionbar and icons would be Red color for Actionbar and white color for your icons.
And how can white icons be visible in white background??? If you remember in Menu icons we have grey background with white icons. That's why they are easily visible in Menu's.