Android xml error: “No resource found that matches the given name” with RelativeLayout (@id/LinearLayout_acc, @id/ProgressBar_statusScreen)

Android xml error: “No resource found that matches the given name” with RelativeLayout (@id/LinearLayout_acc, @id/ProgressBar_statusScreen)

Asked on January 3, 2019 in XML.
Add Comment


  • 3 Answer(s)

    Try below codes for the process:

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/ic_launcher" >
     
    <TableLayout
       android:layout_width="wrap_content"
       android:layout_height="wrap_content" />
     
    <LinearLayout
       android:id="@+id/LinearLayout_dist"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_above="@+id/LinearLayout_acc"
       android:layout_centerHorizontal="true"
       android:layout_marginBottom="10dp" >
     
       <TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="FIRST" />
     
       <TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="SECOND" />
       </LinearLayout>
     
       <LinearLayout
       android:id="@+id/LinearLayout_acc"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_above="@+id/ProgressBar_statusScreen"
       android:layout_centerHorizontal="true" >
     
       <TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="THIRD" />
     
       <TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="FOURTH" />
       </LinearLayout>
     
       <ProgressBar
       android:id="@+id/ProgressBar_statusScreen"
       style="?android:attr/progressBarStyleHorizontal"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:layout_alignParentBottom="true"
       android:layout_margin="16dp" />
     
    </RelativeLayout>
    
    Answered on January 3, 2019.
    Add Comment

    Change the below code,

    @id/LinearLayout_acc
    

    to

    @+id/LinearLayout_acc
    
    Answered on January 3, 2019.
    Add Comment

       Every id @id should be changed to @+id, which is not a thing when it is defining or referencing an id. With this, user will not get, Android xml error: “No resource found that matches the given name” with RelativeLayout (@id/LinearLayout_acc, @id/ProgressBar_statusScreen).

    Answered on January 3, 2019.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.