How to use default Android drawables

前端 未结 6 990
挽巷
挽巷 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:29

    To use the default android drawable resource, no need copy anything.. you can just import it first with..

    import android.R;
    

    but i will make your own resources will have an error if you want to use it. The error will be something like:

    R. cannot be resolved

    So, I prefer not to import android.R but import *my.own.package*.R;

    then when I can normally use my own resource with R.drawable.*something* without error, and put android.R.*something_default* to use the default android resources.

提交回复
热议问题