If you want the views to be below one another, you should be using android:layout_below and not android:layout_toRightOf.
To align them, use android:layout_alignLeft, or alignRight etc. Thanks and Regards, Kumar Bibek http://tech-droid.blogspot.com On Jun 10, 3:00 am, Thierry Legras <[email protected]> wrote: > Hi, > > As i am facing limitation of layout depth in my application, i am replacing > some LinearLayout with RelativeLayout. > However i am stopped by a supposely very simple issue (but apparantly > without clean solution regarding > thathttp://stackoverflow.com/questions/1499555/android-layout-centering-i..., > nor in the ApiDemos sample where RelativeLayout are too simple): > > How can i align vertically 3 items (in a simple way!) which are on a > horizontal line with RelativeLayout without ??? > > does not seem to have any effect at all. > > Here is the xml; in this example i would like an icon at left (fixed width), > a text label in the middle (fixed width) and an edit text on the right > (remaining space). the problem is that the TextView seems to ignore the > parameter android:layout_gravity="center_vertical", and seems to be top > aligned with parent > > <?xml version="1.0" encoding="utf-8"?> > <RelativeLayout > xmlns:android="http://schemas.android.com/apk/res/android" > android:layout_height="wrap_content" android:layout_width="fill_parent" > > > <ImageView > android:id="@+id/Add_ImageView_name" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:layout_gravity="center_vertical" > android:maxWidth="35dip" > android:adjustViewBounds="true" > android:scaleType="fitXY" > android:src="@android:drawable/ic_menu_edit" > /> > <TextView > android:id="@+id/Add_TextView_name" > android:text="blabla" > android:layout_toRightOf="@+id/Add_ImageView_name" > android:layout_gravity="center_vertical" > android:layout_width="50dip" > android:layout_height="wrap_content" > /> > <EditText > android:id="@+id/Add_EditText_name" > android:text="sometext" > android:layout_toRightOf="@+id/Add_TextView_name" > android:layout_alignBaseline="@+id/Add_TextView_name" > android:layout_alignParentRight="true" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > /> > </RelativeLayout> > > Of course i can use marginTop/Bottom and alignTop/Bottom on each single item > but that's not very clean :( > > Any idea? > > -- > Thierry. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

