Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的 android 代码中有一个错误。我的 setContentView 不起作用。我的代码是 setContentView(R.layout.secondlayout); 错误是 secondlayout 无法解决或者不是字段。
确保将 secondlayout.xml 文件放在 res -> layout 文件夹中。还要确保此文件中没有错误。如果您的导入语句中有以下行,请将其删除。
import android.R;
尝试这个
导入 com.example.appname.R
然后,在 Eclipse 中转到 project>clean ,选择您的项目并按 OK。然后等到它完成。清洁操作会重新生成 R。