1

How do we make inline layouts in Android?

Something like this:

I tried using margin right in Relative layouts but they are separated into 2 columns instead of wrapping each other:

<RelativeLayout
    android:id="@+id/Container"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <RelativeLayout
            android:id="@+id/Layout1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginRight="60sp">
            .... //something here
    </RelativeLayout>
    <RelativeLayout
            android:id="@+id/Layout2"
            android:layout_width="60sp"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true">
             .... //something here
    </RelativeLayout>
</RelativeLayout>
double-beep
  • 5,031
  • 17
  • 33
  • 41
markbse
  • 1,023
  • 3
  • 13
  • 26

1 Answers1

0

Layout2 have width 60dp and in layout1 you are putting margin to 60dp so that they looks like a two column If you want to check it change margin of layout1 to 30dp you will see that wrapping effect and also put some controls inside layouts so that you can see the area

Dharmendra
  • 33,296
  • 22
  • 86
  • 129
  • If I remove the margin, the layer1 content is rendered over the layer2. I guess it is becaused android:layout_alignParentRight="true" doesn't make layer2 "float-inline" but "float-underline". – markbse Sep 28 '11 at 05:14