找不到与 Layout_to_left_of 的给定名称匹配的资源
No resource found that matches the given name for Layout_to_left_of
为什么 layout_toLeftOf 属性找不到资源。我在布局中确实有那个 id,以及为什么会这样。我正在使用 Intellij IDEA,即使我尝试重建代码,错误仍然存在。任何建议,提前致谢。
<?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="@dimen/list_item_entry_container_height"
android:padding="@dimen/list_item_entry_container_padding">
<ImageView
android:id="@+id/list_item_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"/>
<ImageView
android:id="@+id/list_item_space"
android:layout_width="@dimen/list_item_entry_space_width"
android:layout_height="fill_parent"
android:layout_toRightOf="@id/list_item_icon"/>
<TextView
android:id="@+id/list_item_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:singleLine="true"
android:textColor="@color/list_item_entry_title_text_color"
android:textSize="@dimen/list_item_entry_title_text_size"
android:layout_toRightOf="@id/list_item_space"
android:layout_toLeftOf="@id/list_item_action"/>
<RelativeLayout
android:id="@+id/list_item_subtitle_group"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/list_item_title"
android:layout_below="@id/list_item_title"
android:layout_toLeftOf="@id/list_item_action"
android:layout_toRightOf="@id/list_item_space">
<ImageView
android:id="@+id/list_item_download_status_icon"
android:layout_width="@dimen/list_item_entry_download_icon_width"
android:layout_height="@dimen/list_item_entry_download_icon_height"
android:visibility="gone"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:contentDescription="@null"
android:layout_marginLeft="@dimen/list_item_entry_download_icon_margin_left"
android:layout_marginTop="@dimen/list_item_entry_download_icon_margin_top"
android:src="@drawable/list_item_download_ok"/>
<ProgressBar
android:id="@+id/list_item_download_status_progressbar"
android:layout_width="@dimen/list_item_entry_download_progressbar_width"
android:layout_height="@dimen/list_item_entry_download_progressbar_height"
android:layout_alignParentLeft="true"
android:layout_marginLeft="@dimen/list_item_entry_download_progressbar_margin_left"
android:layout_marginTop="@dimen/list_item_entry_download_progressbar_margin_top"
android:layout_toRightOf="@id/list_item_download_status_icon"
android:visibility="gone"/>
<TextView
android:id="@+id/list_item_subtitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/list_item_download_status_progressbar"
android:textColor="@color/list_item_entry_subtitle_text_color"
android:textSize="@dimen/list_item_entry_subtitle_text_size"/>
</RelativeLayout>
<ImageView
android:id="@+id/list_item_action"
android:layout_width="@dimen/list_item_entry_action_width"
android:layout_height="fill_parent"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"/>
</RelativeLayout>
替换此行-
android:layout_toLeftOf="@id/list_item_action"
用这条线-
android:layout_toLeftOf="@+id/list_item_action"
原因是list_item_action是在使用后定义的。它在最后定义。以前用过。
按照 amit singh 的建议 - 使用:@+id => 这将定义它是否尚未定义。
或者,在使用之前移动 list_item_action 的定义。
为什么 layout_toLeftOf 属性找不到资源。我在布局中确实有那个 id,以及为什么会这样。我正在使用 Intellij IDEA,即使我尝试重建代码,错误仍然存在。任何建议,提前致谢。
<?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="@dimen/list_item_entry_container_height"
android:padding="@dimen/list_item_entry_container_padding">
<ImageView
android:id="@+id/list_item_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"/>
<ImageView
android:id="@+id/list_item_space"
android:layout_width="@dimen/list_item_entry_space_width"
android:layout_height="fill_parent"
android:layout_toRightOf="@id/list_item_icon"/>
<TextView
android:id="@+id/list_item_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:singleLine="true"
android:textColor="@color/list_item_entry_title_text_color"
android:textSize="@dimen/list_item_entry_title_text_size"
android:layout_toRightOf="@id/list_item_space"
android:layout_toLeftOf="@id/list_item_action"/>
<RelativeLayout
android:id="@+id/list_item_subtitle_group"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/list_item_title"
android:layout_below="@id/list_item_title"
android:layout_toLeftOf="@id/list_item_action"
android:layout_toRightOf="@id/list_item_space">
<ImageView
android:id="@+id/list_item_download_status_icon"
android:layout_width="@dimen/list_item_entry_download_icon_width"
android:layout_height="@dimen/list_item_entry_download_icon_height"
android:visibility="gone"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:contentDescription="@null"
android:layout_marginLeft="@dimen/list_item_entry_download_icon_margin_left"
android:layout_marginTop="@dimen/list_item_entry_download_icon_margin_top"
android:src="@drawable/list_item_download_ok"/>
<ProgressBar
android:id="@+id/list_item_download_status_progressbar"
android:layout_width="@dimen/list_item_entry_download_progressbar_width"
android:layout_height="@dimen/list_item_entry_download_progressbar_height"
android:layout_alignParentLeft="true"
android:layout_marginLeft="@dimen/list_item_entry_download_progressbar_margin_left"
android:layout_marginTop="@dimen/list_item_entry_download_progressbar_margin_top"
android:layout_toRightOf="@id/list_item_download_status_icon"
android:visibility="gone"/>
<TextView
android:id="@+id/list_item_subtitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/list_item_download_status_progressbar"
android:textColor="@color/list_item_entry_subtitle_text_color"
android:textSize="@dimen/list_item_entry_subtitle_text_size"/>
</RelativeLayout>
<ImageView
android:id="@+id/list_item_action"
android:layout_width="@dimen/list_item_entry_action_width"
android:layout_height="fill_parent"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"/>
</RelativeLayout>
替换此行-
android:layout_toLeftOf="@id/list_item_action"
用这条线-
android:layout_toLeftOf="@+id/list_item_action"
原因是list_item_action是在使用后定义的。它在最后定义。以前用过。
按照 amit singh 的建议 - 使用:@+id => 这将定义它是否尚未定义。 或者,在使用之前移动 list_item_action 的定义。