Java android xml错误:';类别';或';接口';必修的
我是android开发新手。下面是我的一个活动的XML代码Java android xml错误:';类别';或';接口';必修的,java,android,xml,textview,android-studio,Java,Android,Xml,Textview,Android Studio,我是android开发新手。下面是我的一个活动的XML代码 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.example.*****.*****.DisplayMessageActivity">
<TextView
android:id="@+id/view_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
请帮忙。
感谢要扭转意外调用Inject Language的效果,请将插入符号放在注入语言的文本字符串中(例如,在第一个屏幕截图中
@dimen/view_text
的某个位置),然后调用“show Intential actions”(在Mac上使用Alt Enter或Option Enter)。菜单中的最后一个选项应该是“Un inject Language”。尝试清理并生成项目并检查。我与您的文件相同,没有出现此类错误。我尝试清理并重建了几次。com.example.********.DisplayMessageActivity
。这真的是一门课吗?我完全不知道为什么这门课不起作用!这与android studio不能正常工作有关吗?非常感谢这对我的帮助
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
String message = intent.getStringExtra(MyActivity.EXTRA_MESSAGE);
TextView textView = (TextView)findViewById(R.id.view_text);
textView.setText(message);
setContentView(R.layout.activity_display_message);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}