RelativeLayout的"无法解析资源..." Android版 [英] RelativeLayout "Couldn't resolve resource..." Android

查看:183
本文介绍了RelativeLayout的"无法解析资源..." Android版的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用低于code,我得到一个错误无法解析资源@ ID / ITEM1这是为什么?之前,我用它的ID / ITEM1为添加,所以我不知道这是为什么来了。

 <?XML版本=1.0编码=UTF-8&GT?;
<的RelativeLayout的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =WRAP_CONTENT
    机器人:方向=垂直>    < ImageView的
        机器人:ID =@ + ID / ITEM1
        机器人:layout_width =50dip
        机器人:layout_height =50dip
        机器人:SRC =@绘制/信息noImage/>
    <的TextView
        机器人:ID =@ + ID / ITEM2
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =WRAP_CONTENT
        机器人:文字=标题
        机器人:填充=3dip
        机器人:TEXTSIZE =20dip
        机器人:layout_toRightOf =@ ID / ITEM1/>
    <的TextView
        机器人:ID =@ + ID /项目3
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =WRAP_CONTENT
        机器人:文字=内容
        机器人:填充=3dip
        机器人:TEXTSIZE =20dip
        机器人:layout_below =@ ID / ITEM1/>< / RelativeLayout的>


解决方案

我没有这个错误你code。

请确保你没有其他资源(布局,价值观,图形等)错误。然后清理/刷新/生成项目

When using the below code, I get an error "Couldn't resolve resource @id/item1" Why is this? id/item1 is added before I use it, so I'm not sure why this is coming up.

<?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="wrap_content"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/item1"
        android:layout_width="50dip"
        android:layout_height="50dip"
        android:src="@drawable/noimage" />
    <TextView         
        android:id="@+id/item2"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Title"
        android:padding="3dip" 
        android:textSize="20dip"
        android:layout_toRightOf="@id/item1"/>
    <TextView         
        android:id="@+id/item3"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Content"
        android:padding="3dip" 
        android:textSize="20dip"
        android:layout_below="@id/item1"/>

</RelativeLayout>

解决方案

I don't have this error with your code.

Make sure you don't have errors in other resources (layouts, values, drawables, etc.). And then clean/refresh/build the project

这篇关于RelativeLayout的&QUOT;无法解析资源...&QUOT; Android版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆