0
我试图垂直堆叠动态高度ImageView
(图像将得到下载和显示,因此不知道高度)与RelativeLayout
,我需要一个像在以下图片的右侧图中蓝色矩形代表ImageView
,红色代表其他RelativeLayout
。垂直堆叠动态高度ImageView与RelativeLayout
到目前为止,我已经试过以下,它给了我左侧数字输出(布局重叠)。
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
card_view:cardCornerRadius="2dp"
card_view:cardUseCompatPadding="true"
card_view:overlay="@drawable/default_selector">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- ImageView represented by Blue rectangle -->
<ImageView
android:id="@+id/thumb_image_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitXY" />
<!-- RelativeLayout represented by Red rectangle -->
<RelativeLayout
android:id="@+id/thumb_bottom_view"
android:layout_width="match_parent"
android:layout_height="@dimen/default_height"
android:layout_alignParentBottom="true"
android:animateLayoutChanges="true"
android:gravity="center_vertical">
<TextView
android:id="@+id/thumb_text_resolution"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:paddingLeft="@dimen/default_gap"
android:paddingRight="@dimen/default_gap"
android:textColor="@color/Thumb.Text"
android:textSize="14sp" />
<ImageButton
android:id="@+id/thumb_button_heart"
android:layout_width="@dimen/default_press_size"
android:layout_height="@dimen/default_press_size"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="?heartBackground"
android:scaleType="centerInside"
android:src="@drawable/ic_action_heart_empty" />
</RelativeLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
为了使它看起来像右侧图,应该怎样改变?