为什么 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>
最佳答案
原因是list_item_action是在使用之后定义的。它在最后定义。以前用过。
正如 amit singh 所建议的那样 - 使用:@+id => 这将定义它是否尚未定义。 或者,在使用之前移动 list_item_action 的定义。
关于android - 找不到与 Layout_to_left_of 的给定名称匹配的资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27810912/