为什么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的定义之前将其移动。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句