How to get dark android icons? - android

I have an item in menu.xml which should have a dark icon. When I use
android:icon="#android:drawable/ic_menu_add"
I can see light version. How to use default dark icons?

For instance if the default app style is Light and you want to use the default dark icons for the menu.xml, it can be done like this:
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="#+id/edit" android:icon="#drawable/ic_menu_copy_holo_dark"
android:title="Edit" />
<item android:id="#+id/prefs" android:icon="#drawable/ic_menu_copy_holo_dark"
android:title="Settings" />
<item android:id="#+id/share" android:icon="#drawable/ic_menu_copy_holo_dark"
android:title="Share" />
</menu>
Refer to Android versions menu drawables for drawables details

Related

Android Material icon not changing in color despite changing of theme (Kotlin)

I have tried numerous solutions but none seems to work, I have been trying to change the color of the icon I have in a menu, I am working with two activities both of which contains different menus, I have attached two images for references
The image represents the MainActivity Menu, it works fine between light and dark theme
The image represents the SecondActivity Menu, the icons refuses to change its color despite manually specifying the iconTint in the menu xml file
Here is the menu of the secondActivity
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:title="More"
android:icon="#drawable/detail_menu"
android:iconTint="#color/white"
app:showAsAction="always">
<menu>
<item
android:id="#+id/browse_news"
android:title="View Full Article"
android:iconTint="#color/white"
android:icon="#drawable/reading_fullarticle"
app:showAsAction="never" />
<item
android:id="#+id/share_news"
android:title="Share Article"
android:iconTint="#color/white"
android:icon="#drawable/read_sharearticle"
app:showAsAction="never" />
<item
android:id="#+id/save_news"
android:title="Save article"
android:iconTint="#color/white"
android:icon="#drawable/read_savearticle"
app:showAsAction="never" />
</menu>
</item>
Here is an image of how the menu icon is supposed to look like according to the xml, I don't think I have overridden any of the styles in the styles XML. Any clues on why this is happening?

NavigationView: one icon isn't tinting but the rest are. How to tint it?

Update: Found a related bug report. https://code.google.com/p/android/issues/detail?id=176133 I upgraded my support libraries to 23.3.0, but it didn't fix the problem.
Update: If I change the icon, then it works. Something isn't working with this message icon.
I have a navigation drawer, and every item is tinting except one. It is using the default settings. They are all tinting to "colorPrimary" when they are selected, except for messaging. How do I get the Messaging icon to also tint?
Correctly tinting icon:
Not tinting this icon though:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<group android:id="#+id/nav_group_sections"
android:checkableBehavior="single">
<item
android:id="#+id/nav_home"
android:icon="#drawable/ic_home_black_24d"
android:title="#string/home"
android:checked="true" /> <!-- default selection -->
<item
android:id="#+id/nav_tools"
android:icon="#drawable/ic_tools_black_24d"
android:title="#string/tools" />
<item
android:id="#+id/nav_web"
android:title="#string/web"
android:icon="#drawable/ic_link_black_24dp"
android:visible="false"/>
<item
android:id="#+id/nav_messaging"
android:title="#string/messaging"
android:icon="#drawable/ic_message_black_24dp"
/>
</group>
</menu>
The icons are these:

Placing icons to action bar

I am placing icons to action bar. It looks like this:
Why search icon is more white? I want to do same color with setting icon. How can I do this?
My xml:
<item android:id="#+id/action_favorites"
android:icon="#drawable/ic_search"
android:title="Takip Listesi"
android:showAsAction="always" />
<item android:id="#+id/action_settings"
android:icon="#drawable/ic_action_settings"
android:title="Settings"
android:showAsAction="always" />
My images:
http://www.imgim.com/ic_action_search.png
http://imgim.com/image/ic_action_settings.png
Note: Images are white, probably you can't see on browser. Please download it.

Remove actionbar item blue background

I am creating an actionbar with custom looking buttons that I put in the icon section of menu.xml.
The problem is that, when I press them, I see both the selected version of the image of the button and the blue background of the holo theme.
This is my menu.xml:
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="#+id/current_position"
android:icon="#drawable/ab_location_layer"
android:menuCategory="container"
android:showAsAction="ifRoom"
android:title="Current position">
</item>
</menu>
The ab_location_layer is this:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="#drawable/ab_location_pressed" android:state_pressed="true"/>
<item android:drawable="#drawable/ab_location" android:state_pressed="false"/>
</selector>
The ab_location_layer contains an image that is smaller than the actionBar.
How is possible to remove the blue background on actionbar? I am also using actionbarsherlock.
Thanks
I found the answer on ActionBarSherlock Mailing List:
you have to put this
<item name="android:selectableItemBackground">#null</item>
<item name="android:actionBarItemBackground">#null</item>
<item name="actionBarItemBackground">#null</item>
to your theme and not in ActionBar theme

How to give background into context menu items

In one of my Android projects, I am creating a context menu from a menu folder inside res. It is as below.
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="#+id/help"
android:title="Help" />
<item android:id="#+id/keyboard"
android:title="Keyboard" />
<item android:id="#+id/exit"
android:title="Exit" />
</menu>
But I want an image to the background of every item. How can I do this?
Try this:
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="#+id/help"
android:title="Help"
android:icon="#drawable/ic_1/>
<item android:id="#+id/keyboard"
android:title="Keyboard"
android:icon="#drawable/ic_2" />
<item android:id="#+id/exit"
android:title="Exit"
android:icon="#drawable/ic_3/>
</menu>
Use styles in your app. Then you can change a default style of Widget.ListView. Note this also changed a style of dialogs with ListView. More details see in this answer.

Categories

Resources