Reputation: 743
In the code below (A custom list item) the Button view is not visible, it's like the ImageView takes all the place and not allow it to appear, how should I modify the code to make it appears at the bottom and rest of the space to be fore the ImageView?
<RelativeLayout
android:id="@+id/inner_container_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/background_with_shadow">
<!-- Title -->
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginRight="25dp"
android:layout_marginEnd="25dp"/>
<!-- Sub Title -->
<TextView
android:id="@+id/sub_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_below="@+id/title"/>
<!-- Ad thumbnail -->
<ImageView
android:id="@+id/cover"
android:background="@drawable/drop_shadow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_below="@+id/sub_title"
android:scaleType="fitXY"
android:src="@android:color/transparent"/>
<Button
android:id="@+id/Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/cover"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:text="Button"/>
</RelativeLayout>
Upvotes: 0
Views: 165
Reputation: 4091
Just align your Button
to your parent bottom and your ImageView
above your Button
. Something like this,
<RelativeLayout
android:id="@+id/inner_container_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/background_with_shadow">
<!-- Title -->
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginRight="25dp"
android:layout_marginEnd="25dp"/>
<!-- Sub Title -->
<TextView
android:id="@+id/sub_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_below="@+id/title"/>
<!-- Ad thumbnail -->
<ImageView
android:id="@+id/cover"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/sub_title"
android:layout_marginBottom="5dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_above="@+id/Button"
android:layout_marginTop="5dp"
android:background="@color/colorAccent"
android:scaleType="fitXY"
android:src="@android:color/transparent"/>
<Button
android:id="@+id/Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:text="Button"/>
</RelativeLayout>
Hope this will help you..!!
Upvotes: 1