这就是我的意思如何使用多个视图组在一个XML纸张
<RelativeLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
/*ALL IN THE SAME XML SHEET*/
<LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
它给了我的错误,当我试图做这样的。有没有其他的替代品
Anuj Kumar要求的代码。我已经尝试互换的xmlns的位置属性
<?xml version="1.0" encoding="utf-8"?>
<linearLayout
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:orientation="portrait">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.ifeoluwa.mcdonaldsapp.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello!"/>
</RelativeLayout>
</linearLayout>
XML文件只能有一个根元素。所以答案可能不是。我已经添加了 –