Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

reference to android.R.drawable.ic_menu_preferences in xml

Tags:

android

There are just two forms i knew to retrieve resource values in xml files: '@' for drawable resources and '?' for theme resources.

Now i want to use 'android.R.drawable.ic_menu_preferences' for the icon used for option menu item 'settings'. But this won't work:

<item android:icon="@android.R.drawable/ic_menu_preferences">

This can be solved in code:

MenuItem settings;
settings.setIcon(android.R.drawable.ic_menu_preferences);

But from dev guide, i knew that it is better to create menu item in xml.

like image 891
kinloo Avatar asked Nov 30 '22 15:11

kinloo


1 Answers

use

<item android:icon="@android:drawable/ic_menu_preferences">
like image 51
josephus Avatar answered Dec 29 '22 08:12

josephus