tags:

views:

22

answers:

2

Hi,

I need to have a linear Layout whose height is wrap_content, but how can I specify a child of this linear layout to stretch to its parent?

I tried ... some other children ...

But this does not work. The image does not scretch.

A: 

wrap_content will stretch it to however big the content inside it is. fill_parent will stretch it to the size of the parent container.

I would try fill_parent for the child.

Ben Burnett
A: 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"

This should fill the parent with the child.

If you have multiple children within the parent and wish to leave no free space in the parent you should use

http://developer.android.com/reference/android/widget/LinearLayout.LayoutParams.html#weight

android:layout_weight" is the factor the view will be stretched, when the parent is larger than its childs in sum.

primalpop