R.java file not updating with UI element's id

前端 未结 8 753
长情又很酷
长情又很酷 2021-01-04 02:03

I added some UI elements to the main.xml file in the res\\layout folder and when I try to access them through the call, R.layout.my_uielement, the UI element th

相关标签:
8条回答
  • 2021-01-04 02:53

    Use R.id.your_ui_element, not R.layout.your_element

    0 讨论(0)
  • 2021-01-04 03:01

    This may not be the case for you, but sometimes when I use something from the android.R package (default android resources) and I use it in my class before making reference to anything from my own resource package, Eclipse adds the import android.R; statement in my imports. This will conflict with the default behavior of implicitly looking in your package's resources.

    Check your import statements for import Android.R;. If it's there, remove it. And, if you're using anything from android.R, fully qualify it when you use it in code.

    0 讨论(0)
提交回复
热议问题