0
我试图实现下图中右侧的布局。我目前得到的是在左边。视图没有采用与父亲相同的高度RelativeLayout
这里是我的布局:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<ImageView
android:id="@+id/garment_grid_item_image"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/gridview_image_placeholder"
android:contentDescription="@string/blank"
android:scaleType="centerCrop"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/garment_grid_item_on_loan"
android:src="@drawable/icon_borrowed"
android:contentDescription="@string/blank"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:visibility="gone"
/>
<View
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/item_border"
/>
</RelativeLayout>
@drawable/item_border
(浅绿色就是突出的透明区域):
的RelativeLayout
作为一个012的项目模板。代码中正在填充garment_grid_item_image
。 garment_grid_item_on_loan
是右上角的紫色三角形,其可见性由代码控制。
底部的View
使用了9个补丁,这是我遇到的问题之一。我希望它和父母RelativeLayout
一样高,但match_parent
或fill_parent
都不起作用。我能做些什么来实现它的工作?
你可不可以把'android:background =“@ drawable/item_border”'放到'RelativeLayout'而不是使用另一个'View'内?或者我错过了你在这里做什么? – Rawkode 2013-02-27 12:51:27
这将涉及设置填充它将不得不改变不同的屏幕尺寸。我想使用3个不同的9个补丁映像(xhdpi,hdpi,mdpi)。 – boz 2013-02-27 13:29:32