What is better android.R or custom R?

前端 未结 4 1352
醉酒成梦
醉酒成梦 2020-12-10 12:38

When I started developping android applications, I had a tendency to define custom R values wherever I need, in particular in layout files. For instance:

fin         


        
4条回答
  •  猫巷女王i
    2020-12-10 13:19

    Custom. The system-provided IDs come with a risk of referring, in code, to a resource that is not present in the project. Customs IDs exist iff there's a corresponding resource - a drawable, a view, a layout or what have you.

提交回复
热议问题