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.
My 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>
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.
ERROR DESCRIPTION: Top level element is not completed. Valid XML document must have a root tag.
Anyway the document is well formed... And it says the same error each time I write "@drawable/..."
EDIT: 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.
Can anyone help me please?
error: Error: No resource found that matches the given name (at 'src' with value '@drawable/backstate').
?