Android 如何内联换行布局?
我们如何在Android中制作内联布局 大概是这样的: 我尝试在相对布局中使用右边距,但它们被分成两列,而不是相互环绕:Android 如何内联换行布局?,android,layout,inline,word-wrap,Android,Layout,Inline,Word Wrap,我们如何在Android中制作内联布局 大概是这样的: 我尝试在相对布局中使用右边距,但它们被分成两列,而不是相互环绕: <RelativeLayout android:id="@+id/Container" android:layout_width="fill_parent" android:layout_height="fill_parent"> <RelativeLayout android:id="@+id/La
<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>
.... //这里有东西
.... //这里有东西
布局2的宽度为60dp,在布局1中,您将边距设置为60dp,这样它们看起来就像一个两列。如果您要检查它,请将布局1的边距更改为30dp,您将看到环绕效果
还可以在布局中放置一些控件,以便您可以看到该区域如果我删除边距,则第1层内容将在第2层上呈现。我想这是因为android:layout\u alignParentRight=“true”不会使layer2成为“float inline”,而是“float underline”。