Reputation: 25074
I'm struggling with a widget layout. Essentially I have an image above some text, wrapped in a vertical LinearLayout container. The image seems to take up all the space in the container (aligned at the bottom of the widget) forcing the text off the bottom of the widget and therefore its not visible. Is there a way to get the image to auto-resize to avoid any other views below it from being forced out of the containers view? Here's the code:
<LinearLayout
android:id="@+id/vertical_container"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/the_image"
android:src="@drawable/image_32"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/the_poor_text_which_doesnt_show"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Where am I?"
android:textColor="#ffffff"
android:textSize="11dip" />
</LinearLayout>
Upvotes: 1
Views: 695
Reputation: 2232
Try using a RelativeLayout instead of a LinearLayout, declaring the TextView first with the parameter android:layout_alignParentBottom="true", and then the ImageView, with android:layout_above="@+id/the_poor_text_which_doesnt_show".
Upvotes: 1