You can use gravity for the wrapper layout of the views. LinearLayout - gravity center --------RelativeLayout --------------ImageView --------------TextView (below Imageview) --------/RelativeLayout /LinearLayout
On Nov 2, 4:14 pm, Robert <sebastianar...@hotmail.com> wrote: > Hello, > I have an ImageView and a TextView which I want to have in one line > and center it on the screen. Unfortunatelly with my code the Textview > is not displayed but the Image is centered. > > <LinearLayout > xmlns:android="http://schemas.android.com/apk/ > res/android" > android:layout_width="fill_parent" > android:layout_height="wrap_content" > android:orientation="horizontal" > android:layout_gravity="center" > > > <RelativeLayout > xmlns:android="http://schemas.android.com/apk/ > res/android" > android:layout_width="wrap_content" > android:layout_height="fill_parent" > > > <ImageView > android:src="@drawable/thumbup" > android:layout_width="fill_parent" > android:layout_height="wrap_content" > android:layout_gravity="center" > /> > </RelativeLayout> > <TextView > android:layout_width="fill_parent" > android:layout_height="wrap_content" > android:layout_gravity="center" > /> > </LinearLayout> > > I suppose it is because I have "fill_parent" in the ImageView, but > whenever I replace that with "wrap_content" nothing will be centered. > > Can somebody please help me!? > > Thanks -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en