Deekshit wrote: > Hi all, > I wanted to place a text and a horizontal line. To group various > fields in a UI. I wanted the line to be aligned center(vertically) with > respect to the textview. I trie dthe following piece of code. It does > not work. The line (wsing View tag) always stays at the top. I set the > gravity to center_horizontal. Still no use. Please help me. > > <LinearLayout android:orientation="horizontal" > android:layout_width="fill_parent" > android:layout_height="wrap_content"> > <TextView android:text="Download" > android:layout_width="wrap_content" android:layout_height="wrap_content"/> > <View android:layout_width="fill_parent" > android:layout_height="2dip" > android:background="#FFFFFFFF" android:gravity="center"/> > </LinearLayout>
android:gravity controls the positioning of the contents of a widget or layout in its available space. That is not what you want here. The simplest way to implement this is to use a RelativeLayout, using android:layout_alignParentTop="true" on the TextView and android:layout_centerVertical="true" on the View. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- 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

