Reputation: 7508
I have a ScrollView with some elements. My problem is that i can't set textview's above ImageView's with dynamical height.
I have 3 ImageView with different height, they can be visible or gone.
Above them i need to put text with background color, this text need to be at the bottom part of the ImageView
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/pic"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</ImageView>
<TextView
android:id="@+id/third_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:padding="8dp"
android:layout_alignParentBottom="true"
android:layout_above="@id/third_picture"
android:gravity="center_horizontal"
android:background="@android:color/white"
android:text="example text">
</TextView>
I tried a lot, but my View was always broken. Please help, i need some proffesional advise.
Upvotes: 0
Views: 384
Reputation: 2595
You can set your picture as a background for a layout (e.g linear layout ) rather than using an ImageView and then put the textview inside it and place it where ever you want.
<LinearLayout
android:background="your picture" >
<!-- align it to the bottom -->
<TextView
/>
</LinearLayout>
Upvotes: 0
Reputation: 8488
You can do this in textview:
android:layout_alignBaseline="@id/pic"
This will align the baseline of textview with basline of imageview
Upvotes: 1