简体   繁体   English

标签ID不适用于AndroidStudio中的一项活动

[英]Label ID doesn't work with one activity in AndroidStudio

In Android Studio I have the MainActivity.java and the activity_main , but the ID of the items doesn't work. 在Android Studio中,我具有MainActivity.javaactivity_main ,但这些项目的ID不起作用。 How I can solve it? 我该如何解决?

在此处输入图片说明

Try changing your ids like this in the xml: 尝试在xml中像这样更改您的ID:

android:id="@+id/place"

android:id="@+id/view"

android:id="@+id/list"

New id will have @+ , when you're referring to an id which is already created, you will have just @ . 新的ID将带有@+ ,当您引用已经创建的ID时,您将只有@

Try to set 尝试设定

tools:context=".MainActivity"

Instead of 代替

tools:context=".httpclientdavid"

Because the context attribute should be the same as the activity... 因为上下文属性应该与活动相同...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM