@layout/activity_main does not contain a declaration with id XXX, findViewById(R.id.XXX) burst red solution...

Problem Description:

In MainActivity.java, look for the checkbox by id, which can obviously display the id of this component, and Ctrl+click can also jump to the past, but it is popular, prompting @layout/activity_main does not contain a declaration with id XXX

 

 jump successfully

Solution:

Turns out setContentView(R.layout.activity_main); did not change. Change setContentView(R.layout.activity_main); to the file name where the id you are looking for can be found.

Guess you like

Origin blog.csdn.net/LYly_B/article/details/129870811