java Android Studio MainActivity标记红色错误。新手
大家好,我是安卓 studio的新手,我发现了这个错误,有人能帮我吗。我不知道该怎么解决这个错误。它说MainActivity是一个未解决的类
主要活动。xml文件:
<?xml version="1.0" encoding="utf-8"?>
<安卓.support.constraint.ConstraintLayout xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
xmlns:app="http://schemas.安卓.com/apk/res-auto"
xmlns:tools="http://schemas.安卓.com/tools"
安卓:layout_width="match_parent"
安卓:layout_height="match_parent"
tools:context="com.example.andriod.justjava.MainActivity">
<LinearLayout
安卓:layout_width="match_parent"
安卓:layout_height="match_parent"
安卓:orientation="vertical">
<TextView
安卓:layout_width="match_parent"
安卓:layout_height="wrap_content"
安卓:text="QUANTITY"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
安卓:id="@+id/quantity_text_view"
安卓:layout_width="match_parent"
安卓:layout_height="wrap_content"
安卓:padding="16dp"
安卓:text="0"
安卓:textColor="@安卓:color/black"
安卓:textSize="16sp" />
<TextView
安卓:layout_width="match_parent"
安卓:layout_height="wrap_content"
安卓:text="Price"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
安卓:id="@+id/price_text_view"
安卓:layout_width="match_parent"
安卓:layout_height="wrap_content"
安卓:padding="16dp"
安卓:text="$0"
安卓:textColor="@安卓:color/black"
安卓:textSize="16sp" />
<Button
安卓:id="@+id/button"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:onClick="submitOrder"
安卓:text="Order" />
</LinearLayout>
</安卓.support.constraint.ConstraintLayout>
错误显示在
` tools:context="com.example.andriod.justjava.MainActivity">
`
谢谢你的帮助
# 1 楼答案
不确定这是不是,但你拼错了“android”:
# 2 楼答案
当您输入错误的包名时,会出现此问题吗?试着改变它
还是将此活动添加到清单文件