Brian wrote:
> How do you specify an Android icon in xml?  I'm trying to make a menu
> with an "Add" button using the stock Android Add icon, like so:
> 
>     <item android:id="@+id/menu_add"
>         android:title="Add"
>         android:icon="@drawable/ic_menu_add" /
>>                              // Doesn't work.
>         android:icon="@drawable/android.R.drawable.ic_menu_add" /> //
> Also doesn't work.
>         android:icon="@android.R.drawable/ic_menu_add" /
>>               // Also doesn't work.
> 
> As you can see, I'm not sure how to re-use the android "Add" icon in
> my xml (without copying it & pasting it in my app, or setting it
> programatically I suppose)
> 
> I know the icon exists, as I can do  this on a dialog:
>  .setIcon(android.R.drawable.ic_menu_add)

Try android:icon="@android:drawable/ic_menu_add"

Note that there was an extended thread on [android-developers] not that
long ago, where we were given official advice to be careful when
referencing internal graphics like that. Different devices will have
different themes, and so the icons will change look. If you need the
icon to keep consistent (e.g., to match other icons you are drawing),
make yourself a local copy of the image.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Warescription: Three Android Books, Plus Updates, $35/Year

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to