Why shouldn't I use the menu icons provided by the OS?
I would like to use some of the default menu icons provided by the Android OS.
The XML would be something like this:
<item android:id="@+id/menu_refresh"
android:icon="@android:drawable/ic_menu_refresh"
android:title="@string/menu_refresh" />
But the documentation says this is unadvised.
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).
I thought the whole point of using the default icons is because the design does c开发者_如何转开发hange from OS to OS. By using the default icons, your app will look and feel appropriate for the OS it's running on. So what is so bad about using the default icons? It seems like not using the default icons would hurt the appearance of the app.
The problem is that you are adding in a dependency that google does not guarantee will be static.
The names of these icons could change, the size could change and become incompatible with your app.
If you want icons to be the same as the current google ones, you can use the ones available here
It is very possible that some configuration of android will NOT have these resources read: HTC Sense, Samsung TouchWiz.
What you can do is find the drawables you want in your sdkFolder/platforms/platform-#/data/res/ and drop them into your project. Then reference them as you would any normal resources (@drawable/icon).
IMO, in practice you can use menu icons provided by Android OS, as long you use only the icons provided by OS for all your menu items. If you need another icon (say, refresh), you will need to copy images for other icons as well. Otherwise, if you mix your own and OS icons, visual styles may differ significantly on some devices.
I really can't think of a reason not to other than what if your operation does something more than slightly different from the associated action the OS does. For an exagerated instance, if you had your trash can button be the place where you created new widgets. But I figure if you are keeping the operations similar to those of the OS, then you are fine. In fact I agree with you, it may even look better for the app.
The problem is with the "customizations" each carrier or factory makes to the OS, so you cannot assume they are present or match the use. Anyhow,if you like them, you might just copy them to your drawables, as they will look standard no matter the customizations.
Also it can vary from android version to another android version.. So it would be best to include your own set of icons
精彩评论