How to use default Android drawables

前端 未结 6 978
挽巷
挽巷 2020-11-30 02:44

What is the best approach when using default Android drawables? Should I use android.R.drawable or should I copy the drawables in my project and use R.dra

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-30 03:43

    As far as i remember, the documentation advises against using the menu icons from android.R.drawable directly and recommends copying them to your drawables folder. The main reason is that those icons and names can be subject to change and may not be available in future releases.

    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.

    from: http://developer.android.com/guide/practices/ui_guidelines/icon_design_menu.html

提交回复
热议问题