Are basic icons in Android system-inherited?
I've noticed that some system programs in Android (Messages, Contacts, Settings, ...) uses the same icon in the menu (search, add, ...), and they're different in (almost) every OS version.
So I have a question. Are they come from system files? Can I use these icon in my program without having to capture-开发者_运维百科copy-paste them into res folder?
Thanks.
This is what Android UI Guidelines say about Menu Icons:
Warning: Because these resources can change between platform versions, you should not reference these icons using the Android platform resource IDs (i.e. menu icons under android.R.drawable). If you want to use any icons or other internal drawable resources, you should store a local copy of those icons or drawables in your application resources, then reference the local copy from your application code. In that way, you can maintain control over the appearance of your icons, even if the system's copy changes.
Yes you can use system resources without copy-ing them to your res folder.
Here is an nice collection of a lot of system drawables.
http://androiddrawableexplorer.appspot.com/
Implementation: e.g.: android:icon="@android:drawable/ic_menu_save"
by coding we can use like this
android.R.drawable.ic_menu_save
精彩评论