I'd be surprised if you could do this with any of the standard layouts. You may have to create your own custom layout. Should be too hard by copy-pasting then modifing one of the existing layouts.
On Aug 29, 3:26 pm, skyhigh <[email protected]> wrote: > I am trying to display two strings on the same line, with one being flush > left and the other flush right. If the screen display size is two narrow to > show both strings on the same line, then I would like one of the strings to > move down to a second line, so that they do not overlap making the text > unreadable. > > With CSS this is simple to do, just setting one string to flush left, and > the other to flush right does this > > I have been attempting to do this same thing on the Android using a > RelativeLayout, but I can't seem to figure out the correct settings so that > they will both show on the same line if the screen is wide enough, but will > show on two separate lines if the screen is too narrow. > > These are the settings I thought would work. Note: I have separated the > label text from the value text because I intend to set these to different > custom typefaces. > > <RelativeLayout > android:layout_width="fill_parent" > android:layout_height="wrap_content" > > <LinearLayout > android:id="@+id/string1_layout" > android:orientation="horizontal" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:layout_alignParentTop="true" > android:layout_alignParentLeft="true" > > > <TextView > android:id="@+id/string1_label" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > /> > <TextView > android:id="@+id/string1_value" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > /> > </LinearLayout> > <LinearLayout > android:id="@+id/string2_layout" > android:orientation="horizontal" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:layout_alignParentRight="true" > > > <TextView > android:id="@+id/string2_label" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > /> > <TextView > android:id="@+id/string2_value" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > /> > </LinearLayout> > </RelativeLayout> > > I have tried a number of other variations, like setting string2 to > layout_below string1, which always forces string2 onto a lower line even on > wide screens; and setting string2 to be layout_alignRight of string1, which > causes string 2 to wrap onto multiple lines, all to the right of string 2, > but the top line does not move down, and it does not use all the available > space on the second line, but instead sometimes wraps it to a 3rd and even a > 4th line with all the text crunched on the right side of string1. -- 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

