Whats wrong with this simple Layout?

Posted by Sebi on Stack Overflow See other posts from Stack Overflow or by Sebi
Published on 2010-05-05T12:54:47Z Indexed on 2010/05/05 12:58 UTC
Read the original article Hit count: 445

Filed under:

Im trying to define a LinearLayout which contains another LinearLayout which should always be desplayed in the horizontal and vertical center. An ImageView should be placed always vertically centered on the right side of the parent Layout:

                                 A                                           B

I defined it the following:

 <LinearLayout android:id="@+id/footer"

android:orientation="horizontal" android:layout_height="50px" android:paddingTop="5px" android:layout_width="wrap_content" android:background="@drawable/footer_border" android:paddingRight="5px" android:paddingLeft="5px" android:layout_gravity="center_horizontal">

 <ImageView
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_gravity="right"
 android:id="@+id/loading">
 </ImageView>

 </LinearLayout>

But unfornatuley its not working... The LinearLayout (A) and the ImageView (B) is on the left side.... But i set gravity to center and right?? Why?

© Stack Overflow or respective owner

Related posts about android