元素RelativeLayout必须声明 [英] element RelativeLayout must be declared
本文介绍了元素RelativeLayout必须声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到错误消息必须声明 RelativeLayout
元素",但我不知道其发生的原因.我如何摆脱此错误,请发布建议或代码段.这是我的 drawer_list_item.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>
推荐答案
我遇到了同样的错误,因为我在 drawable
文件夹中而不是中添加了添加的
文件夹 Layout资源文件
>布局
I had faced same error because I add added Layout resource file
inside drawable
folder instead of layout
folder
确保将
布局文件
放在布局目录
这篇关于元素RelativeLayout必须声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文