Mar*_*inS 1 android relativelayout android-layout
我有一个相对布局在运行时工作正常,但在Eclipse图形布局设计器中我收到异常
无法解析资源@ id/imgSessionOutcome_Product1_Icon
imageview的资源是定义的,并且在引用它之前,所以我不能完全看出问题是什么?该异常列出两次,因此对它的引用均失败.
我保存/清理了项目,以确保资源重建,仍然是同样的错误.
Eclipse版本:在OSX上运行的Helios Service Release 2,带有最新更新等.
<RelativeLayout
android:id="@+id/lySessionOutcome_Product1"
android:layout_width="match_parent"
android:layout_height="55dip"
android:layout_marginLeft="10dip"
android:layout_marginRight="5dip"
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:id="@+id/imgSessionOutcome_Product1_Icon"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="true"
android:layout_marginRight="10dip"
android:src="@drawable/gr_bag_bc" />
<TextView
android:id="@+id/tvSessionOutcome_Product1_Description"
android:layout_width="fill_parent"
android:layout_height="26dip"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/imgSessionOutcome_Product1_Icon"
android:ellipsize="marquee"
android:singleLine="false"
android:text="Description" />
<TextView
android:id="@+id/tvSessionOutcome_Product1_Type"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@id/tvSessionOutcome_Product1_Description"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_alignWithParentIfMissing="true"
android:layout_toRightOf="@id/imgSessionOutcome_Product1_Icon"
android:gravity="center_vertical"
android:text="Product type"
android:textAppearance="@style/largeBlack" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
尝试使用
android:layout_toRightOf="@+id/imgSessionOutcome_Product1_Icon"
Run Code Online (Sandbox Code Playgroud)
好吧,我很久以前回答了这个问题,我不知道为什么会这样,我仍然不确定,但根据我的观察,我认为使用+符号会创建一个临时的视图引用,以便我们可以在Android布局编辑器中查看它,实际的锚点视图仅在运行时被选中.
如果您不使用+符号,它在运行时工作正常,如问题本身所述.如果我错了,请纠正我.
| 归档时间: |
|
| 查看次数: |
2912 次 |
| 最近记录: |