Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

element RelativeLayout must be declared

Tags:

android

xml

I'm getting the error "element RelativeLayout must be declared" and I don't know the reason for its occurrence. How do I get rid of this error, please post suggestions or code snippets. This is my drawer_list_item.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@id/drawer_list_item"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@drawable/list_selector">

<ImageView
    android:id="@+id/icon"
    android:layout_width="25dp"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_marginLeft="12dp"
    android:layout_marginRight="12dp"
    android:contentDescription="@string/desc_list_item_icon"
    android:src="@drawable/ic_launcher"
    android:layout_centerVertical="true" />

<TextView
    android:id="@+id/title"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_toRightOf="@id/icon"
    android:minHeight="?android:attr/listPreferredItemHeightSmall"
    android:textAppearance="?android:attr/textAppearanceListItemSmall"
    android:textColor="@color/material_blue_grey_900"
    android:gravity="center_vertical"
    android:paddingRight="40dp"/>

<TextView android:id="@+id/counter"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/counter_bg"
    android:layout_alignParentRight="true"
    android:layout_centerVertical="true"
    android:layout_marginRight="8dp"
    android:textColor="@color/material_blue_grey_900"/>

   </RelativeLayout>
like image 405
thirteenguy Avatar asked Feb 26 '15 12:02

thirteenguy


1 Answers

I had faced same error because I add added Layout resource file inside drawable folder instead of layout folder

make sure to put layout files inside layout directory

like image 139
Basheer AL-MOMANI Avatar answered Sep 18 '22 16:09

Basheer AL-MOMANI