问题描述
每次我把它在红色中下划线标出的@drawable项目。它之前的工作,但我pressed在该行旁边,然后将所有可绘制成了错误出现在灯泡的选择之一。我无法找到问题的...我与Android工作室工作。我试着重建,清洁,重新导入...并没有什么解决问题。
Everytime I put a @drawable item it appears underlined in red. It worked before but I pressed one of the options in the light bulb that appears next to the line and then all drawables became errors. I can't find the problem... I'm working with Android Studio. I tried to rebuild, clean, reimport... and nothing solves the problem.
我的code:
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:shrinkColumns="*" android:stretchColumns="*" android:background="#ffffff">
<TableRow
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:gravity="center_horizontal">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:id="@+id/back"
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp"
android:background="@null"
android:src="@drawable/backstate" /> /////////////////ERROR in "@drawable/backstate" (Underlined in red)
</TableRow>
<TableRow
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:gravity="center_horizontal">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:id="@+id/blanc"
android:layout_marginTop="50dp"
android:layout_marginLeft="20dp"
android:background="@null"
android:src="@drawable/blancstate"/> /////////////////SAME ERROR
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:id="@+id/groc"
android:layout_marginTop="50dp"
android:layout_marginRight="20dp"
android:background="@null"
android:src="@drawable/grocstate"/> /////////////////SAME ERROR
</TableRow>
<TableRow
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:gravity="center_horizontal">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:id="@+id/taronja"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:background="@null"
android:src="@drawable/taronjastate"/> /////////////////SAME ERROR
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:id="@+id/vermell"
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:background="@null"
android:src="@drawable/vermellstate"/> /////////////////SAME ERROR
</TableRow>
</TableLayout>
所有的XML状态是正确的,布局是良好的,我没有改变从code什么,并通过单击我不记得选项,则所有可绘就开始给我的错误。
All xml states are correct, layouts are well formed, i didn't change anything from the code, and by clicking that option that I didn't remember, all drawables started to give me errors.
错误描述:顶级元素未完成。有效的XML文档必须有一个根标签。
ERROR DESCRIPTION: Top level element is not completed. Valid XML document must have a root tag.
但无论如何,文档结构良好......这每一个我写时说了同样的错误@drawable /...\"
Anyway the document is well formed... And it says the same error each time I write "@drawable/..."
编辑:我找到了问题的根源 Android的命名空间的问题,如果我改变它的工具命名它的工作原理。工具:SRC =@绘制/ vermellstate例如:
I found the origin of the problem. android namespace is the problem, if I change it for tools namespace it works. tools:src="@drawable/vermellstate" for example.
谁能帮我吗?
推荐答案
试试这个:
这是显示错误选择的项目,然后preSS ALT 骨节病> + 输入骨节病>上调用错误的绘制项目(例如:@绘制/ vermellstate)并选择Uninject语言/参照
Select item that is displaying error, then press + on the drawable item which calls error (for example:"@drawable/vermellstate") and select "Uninject language/reference"
这篇关于错误在SRC ImageButtons:&QUOT; @drawable /...& QUOT;顶级元素未完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!