无法解析类android.support.constraint.ConstraintLayout
我这条线是红色的无法解析类android.support.constraint.ConstraintLayout,android,android-constraintlayout,Android,Android Constraintlayout,我这条线是红色的 <android.support.constraint.ConstraintLayout 确保在build.gradle(项目名称)文件中声明了maven.google.com存储库: 将库作为依赖项添加到build.gradle(模块:app)文件: 要使用约束布局写入: 非常感谢您!但如何摆脱类似名称空间的东西,只需在布局xml中保留ConstraintLayout <?xml version="1.0" encoding="
<android.support.constraint.ConstraintLayout
build.gradle(项目名称)
文件中声明了maven.google.com
存储库:build.gradle(模块:app)
文件:约束布局
写入:
非常感谢您!但如何摆脱类似名称空间的东西,只需在布局xml中保留ConstraintLayout
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"
tools:context=".MainActivity">
<Button
android:id="@+id/act1Btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:text="Bill Calculation"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/askOptions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:text="What you want to do?"
android:textColor="#00BCD4"
android:textSize="30sp"
app:layout_constraintBottom_toTopOf="@+id/act1Btn"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/btn3"
android:layout_width="130dp"
android:layout_height="55dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:text="Tax Calc"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/act1Btn" />
<Button
android:id="@+id/btn4"
android:layout_width="142dp"
android:layout_height="46dp"
android:text="Mobile Tax"
app:layout_constraintBottom_toTopOf="@+id/btn3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/act1Btn" />
</android.support.constraint.ConstraintLayout>
repositories {
google()
}
dependencies {
implementation "androidx.constraintlayout:constraintlayout:2.0.4"
}