What is better android.R or custom R?

前端 未结 4 1347
醉酒成梦
醉酒成梦 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条回答
  •  自闭症患者
    2020-12-10 13:05

    android.R is meant for utilizing resources built in to the operating system.

    There are many images/layouts/etc... that come with the operating system that you can just reference using android.R

    if you are referencing your own resources that you have created, most always use R. and in most situations I recommend trying to stay away from the built in resources as they change version to version.

提交回复
热议问题