[英]Android Studio is giving me AAPT error on uneditable XML files
[英]Android - Error in XML files
所以我正在构建一个项目,但是我的R.Java以某种方式被删除了(原因?)并且它显示R无法解析为变量,现在该怎么办? 我的布局中也没有main.out.xml,所以没有问题。
另一个问题是我的XML文件在底部的两行中分别显示了这些错误:
1 - 解析XML时出错没有找到任何元素(不知道这意味着什么。)
2 - XML文档结构必须在同一个实体内开始结束。(找不到一个未关闭的标签,帮帮我吧!)
这是我困扰的XML文件的代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/imgthing"
android:orientation="vertical" >
<EditText
android:id="@+id/editText1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ems="10" >
</EditText>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@drawable/imgthing"
android:orientation="horizontal"
android:weightSum="100" >
<TextView
android:id="@+id/textView2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="50"
android:gravity="center"
android:text="TextView" />
<TextView
android:id="@+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="50"
android:gravity="center"
android:text="TextView" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/imgthing"
android:orientation="horizontal"
android:weightSum="2" >
<RadioGroup
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical" >
<RadioButton
android:id="@+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RadioButton" />
<RadioButton
android:id="@+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RadioButton" />
<RadioButton
android:id="@+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RadioButton" />
</RadioGroup>
<RadioGroup
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical" >
<RadioButton
android:id="@+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RadioButton" />
<RadioButton
android:id="@+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RadioButton" />
<RadioButton
android:id="@+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RadioButton" />
</RadioGroup>
<TextView
android:id="@+id/textView3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="TextView" />
<Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
</LinearLayout>
此外,当我在图形布局中查看时,其中没有可见的单选按钮。 如果重要的话,我有一个白色背景。 编辑:第二个错误消失了,重新发布代码,它只有第一个错误。
你忘了关闭你的父布局,只需关闭它就可以了!
在文件末尾添加
</LinearLayout>
希望这可以帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.