Thanks Kostya that is doing the trick! On Nov 2, 12:21 pm, Kostya Vasilyev <kmans...@gmail.com> wrote: > Your TextView and ImageView have exactly the same layout attributes, so > they end up on top of one another. > > If you need them side-by-side, put them in a LinearLayout that has > width=wrap_content, and then center that linear layout within its parent > by using layout_gravity=center. > > Oh, and you only need to specify the namespace (xmlns:android) once, on > the top-most XML tag. Doesn't do harm, but makes it hard to tell whether > the first view you posted is the first (top-level) view in the file. > > -- Kostya > > 02.11.2010 14:14, Robert пишет: > > > > > > > > > > > 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 > > -- > Kostya Vasilyev -- WiFi Manager + pretty widget > --http://kmansoft.wordpress.com
-- 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