How can I access all drawables in android?

前端 未结 4 1137
攒了一身酷
攒了一身酷 2020-12-03 01:58

Only some drawables are accessible via the syntax. For example expander_ic_maximized is not accessible, yet its cle

4条回答
  •  爱一瞬间的悲伤
    2020-12-03 02:27

    you just need to add this in your imports list:

    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.

    well, choosing which one to use, depends in what you need.. :)

提交回复
热议问题