I've changed Navigation Drawer with Navigation view and it works well.
I was using following code to make all items white in action bar :
<.item name="android:textColorPrimary">
The problem is Navigationview gives error if I use this code.
How this could be possible while both library were written by Google ?
PS : I work on Xamarin Android
Thanks
Do you mean to have a . before item?, I believe it should read <item name="android:textColorPrimary"> if I am not mistaken.
I think you are mixing things together now. Actionbar has nothing to do with the colors of the items in the NavigationView.
You should set the 'app:itemTextColor="#009688"' on the NavigationView to color the text of the items.
More on how to style the NavigationView you can find here: How to customize item background and item text color inside NavigationView?
Related
When working with NavigationView there is a tools:showIn="navigation_view" on its menu.xml file which make its preview turn into a hamburger menu style and not a regular Toolbar action item.
Is there any other value we can provide to showIn that is default to Android platform itself? I know we can also provide a layout but what I am looking for is its equivalent on other navigation view like BottomNavigationView.
In my application am creating navigation drawer.I don't want to customize menu using listview and all.But am stuck with navigation menu item and text alignment.I need to be little bit near.Please find the attached screenshot.Is that possible using with changing style.
you can override the default padding of NavigationView on dimens.xml
try to put this to your dimens.xml
<dimen tools:override="true" name="design_navigation_icon_padding">5dp</dimen>
I am using the library MaterialDrawer in my android application to create the drawer, but it shows some white after scrolling the drawer.
How may I hide this?
To remove fading edges include this lines in your xml layout android:fadingEdge="none"
for more details check this link
The shown issue is fixed in the latest version of the library.
If you can't update use the Drawer object to get the reference to the ListView with, getListView() you can then modify this property via
drawer.getListView().setFadingEdgeLength(0);
drawer.getListView().setCacheColorHint(Color.TRANSPARENT);
I'm working on a project where I need to change the actionbar color within a single activity multiple times according to the content. This is done using
bar.setBackgroundDrawable(colorDrawable);
WITH this line, a portion of the actionbar turns transparent/grey (base theme is #style/Theme.AppCompat.Light.DarkActionBar) as soon as the navigation drawer is opened.
WITHOUT it, the background stays solid as expected even when the navigation drawer is opened. However, this does not allow for diffrent colored pages.
I'm using the support actionbar from appcompat 7, but it can be reproduced with a Toolbar as well as on multiple android versions.
Any ideas WHY this happens? Have I just messed up or is this in fact a bug?
Any workarounds, apart from setting a fixed color for the actionbar?
Note the right area of the actionbar that has become grey/transparent after opening the navigation drawer
I solved it. Kind of...
Please post other solutions if you can improve on this, as it is not the cleanest solution.
Changing the above mentioned
bar.setBackgroundDrawable(colorDrawable);
to
bar.setBackgroundDrawable(new ColorDrawable(((ColorDrawable) colorDrawable).getColor()));
solved the problem for me. This really should not have to be done though.
How can I change the Android StackedActionBar's Tab text color, Tab divider color, and selected navigation Tab selector color dynamically at runtime using java? I have not been able to find solutions for this without having to alter my XML each time. I have however been able to change the StackedActionBar's background color using the method for the ActionBar class:
setStackedBackgroundDrawable(Drawable drawable)
Thanks for any help in advance.
If you are adding Stacked Tabs to the Actionbar pragmatically, then you can do the styling stuff via Java. If you are declaring the Actionbar's components in XML, then you cannot highly modify the styling stuff via Java.
Here is a detailed link for dealing with Action bar.