【发布时间】:2014-05-26 17:40:07
【问题描述】:
我无法制作填充RelativeLayout 高度的View,这是ListView 项目的布局。这是我的布局:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<View
android:id="@+id/fill_the_height_please"
android:layout_width="15dp"
android:layout_height="match_parent"
android:background="@color/red"/>
<TextView
android:id="@+id/delivery_list_item_dest"
android:layout_width="wrap_content"
android:layout_toRightOf="@id/fill_the_height_please"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="2dp"
android:text="Destinatario" />
<TextView
android:id="@+id/delivery_list_item_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/delivery_list_item_dest"
android:layout_below="@id/delivery_list_item_dest"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:text="Location" />
<ImageButton
android:id="@+id/delivery_list_item_mapBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="0dp"
android:src="@drawable/map_location"
android:background="@null" />
ID 为 fill_the_height_please 的视图未填充项目高度。在下图中您可以看到结果(没有显示):
我想要这样的东西:
ù
我也尝试如下更改视图布局,但无论如何都不起作用:
<View
android:id="@+id/fill_the_height_please"
android:layout_width="15dp"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:background="@color/red"/>
请问您能帮助实现我的目标吗?谢谢。
【问题讨论】:
-
ListView项目的布局中没有 ID 为fill_the_height_please的视图。 -
您是否在 color.xml 文件中设置了颜色值?
-
发布您的
color.xml文件。 -
抱歉,Onik,现在是正确的。
-
颜色是一个细节,你可以使用
@android:color/red
标签: android listview android-relativelayout fill-parent