That worked except on problem. There is a large gap between the inner Relative Layout and the Textview above it. Is there a way I can close up the gap?
<TextView android:id="@+id/currentBAC" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/beresp" android:text="@string/nodrinks" android:textColor="#000000" android:background="#aaaaaa"/> <RelativeLayout android:id="@+id/rlytBeer" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/currentBAC"> <ImageButton android:id="@+id/btnBeer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:src="@drawable/beer2" /> <TextView android:id="@+id/tvBeer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/btnBeer" android:layout_centerVertical="true" android:textColor="#000000" android:text="@string/beertxt" /> </RelativeLayout> On Sat, 2009-05-02 at 13:17 -0400, Mark Murphy wrote: > Kevin J. Brooks wrote: > > However now I have another problem maybe someone can help. In the > > following I want to align the Texview in the vertical center of the > > ImageButton. However it isn't working. Any ideas? > > > > <ImageButton android:id="@+id/btnBeer" > > android:layout_width="wrap_content" > > android:layout_height="wrap_content" > > android:layout_below="@id/currentBAC" > > android:src="@drawable/beer2" /> > > <TextView adnroid.id="@+id/tvBeer" > > android:layout_width="wrap_content" > > android:layout_height="wrap_content" > > android:layout_toRightOf="@id/btnBeer" > > android:layout_centerVertical="@id/btnBeer" > > android:textColor="#000000" > > android:text="@string/beertxt" /> > > 1. adnroid.id="@+id/tvBeer" should be android:id="@+id/tvBeer". > > 2. I do not think there is a way to center one widget relative to > another widget -- only centering a widget within the parent. Hence, you > may need to wrap your ImageButton and TextView in their own > RelativeLayout and set both of them to android:layout_centerVertical="true". > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---