Fatima
Fatima

Reputation: 11

I got an ID error in my XML file although it is unique

My xml file was working fine until I created a new TextView and decided to give it an id which is txtVw6 that gave me an error although it is unique. when I press Alter+Enter it gives me create resource id value . Can I Know what is wrong with this ID?

Edit : I've just closed android studio and reopen it again, the error is gone!

<?xml version="1.0" encoding="utf-8"?>
    <ScrollView 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:gravity="center"
        android:orientation="vertical"
        tools:context=".MainActivity">
    
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:orientation="vertical">
    
            <TextView
                android:id="@+id/txtVw1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="25dp"
                android:text="Hello world!"/>
    
            <TextView
                android:id="@+id/txtVw2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="10pt"
                android:textSize="25dp"
                android:textColor="@color/white"
                android:gravity="center"
                android:background="@color/purple_200"
                android:text="15\nJun"/>
    
            <TextView
                android:id="@+id/txtVw3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="10pt"
                android:textSize="25dp"
                android:gravity="center"
                android:text="Text number3"/>
    
            <TextView
                android:id="@+id/txtVw4"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="10pt"
                android:textSize="25dp"
                android:gravity="center"
                android:text="TextView number4"/>
    
            <TextView
                android:id="@+id/txtVw5"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:drawableLeft="@drawable/android0"
                android:layout_marginTop="10pt"
                android:textSize="25dp"
                android:text="Image TextView"/>
    
            <TextView
                android:id="@+id/txtVw6" 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="10pt"
                android:textSize="25dp"
                android:text="TextView 6"/>
    
        </LinearLayout>
    </ScrollView>

Upvotes: 1

Views: 737

Answers (0)

Related Questions