【发布时间】:2020-07-17 08:22:05
【问题描述】:
我刚在android studio学习应用程序开发,我没有很好的java背景,在学习布局时遇到了一个错误,提示多根标签错误,这里是ly代码
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello Carl!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width ="fill_parent"
android:layout_height ="fill_parent"
android:orientation= "vertical">
<Button android:id ="@+id/btnStart"
android:layout_width ="270dp"
android:layout_height= "wrap_content"
android:text ="@+string/Start" />
</LinearLayout>
我该如何解决这个问题,请说明我是否应该一次只使用一种布局?
【问题讨论】:
标签: android xml android-studio layout