我想用右侧的阴影绘制我的整个列表项目。Match_parent高度内部布局与wrap_content高度
问题是我的包装drawable的布局没有一个不变的高度。我厌倦了设置我的绘制对齐父顶部和对齐父底部,但它仍然不会伸展它的父级布局的整个高度。
看ATT右边的阴影(我提供一分钟height属性使其可见,第四列表项比min查看做大,影子不舒展)
来源:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<include layout="@layout/list_item_header" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/img_news_thumb"
android:layout_width="@dimen/listview_one_row"
android:layout_height="@dimen/listview_one_row"
android:scaleType="centerCrop"
android:src="@drawable/default_news_thumb" />
<TextView
android:id="@+id/txt_news_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_alignWithParentIfMissing="true"
android:layout_marginLeft="@dimen/space_m"
android:layout_marginTop="@dimen/space_s"
android:layout_toRightOf="@+id/img_news_thumb"
android:ellipsize="marquee"
android:paddingRight="@dimen/space_m"
android:singleLine="false"
android:text="Title"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/txt_news_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignWithParentIfMissing="true"
android:layout_below="@+id/txt_news_title"
android:layout_marginBottom="0dp"
android:layout_marginLeft="@dimen/space_m"
android:layout_marginTop="@dimen/space_s"
android:layout_toRightOf="@+id/img_news_thumb"
android:ellipsize="end"
android:paddingRight="@dimen/space_m"
android:singleLine="true"
android:text="Date"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/font_light" />
**<ImageView
android:id="@+id/img_news_list_shadow"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/img_news_thumb"
android:minHeight="@dimen/listview_one_row"
android:scaleType="fitXY"
android:src="@drawable/list_shadow_r" />**
<ImageView
android:id="@+id/img_selected_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:scaleType="fitXY"
android:src="@drawable/list_item_arrow"
android:visibility="gone" />
</RelativeLayout>
<include layout="@layout/list_item_devider" />
</LinearLayout>
你使用普通的PNG的阴影或者你使用伸缩niner PNG格式? http://developer.android.com/guide/developing/tools/draw9patch.html –
我使用niner pngs – Richard
尝试android:layout_height =“?android:attr/listPreferredItemHeight”为包含布局的列表项 –