我不知道如何嵌套不同的布局。 我想要并排一个列表布局和一个表格布局。例如,我希望 ListLayout 位于左侧,而 Table 布局位于 liSTLayout 的右侧
<ListView android:id="@android:id/list" android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:focusable="true"
android:focusableInTouchMode="true" />
和一个表格布局
<TableLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
<TableRow>
<TextView
android:layout_column="1"
android:text="Open..."
android:padding="3dip" />
<TextView
android:text="Ctrl-O"
android:gravity="right"
android:padding="3dip" />
</TableRow>
<TableRow>
<TextView
android:layout_column="1"
android:text="Save..."
android:padding="3dip" />
<TextView
android:text="Ctrl-S"
android:gravity="right"
android:padding="3dip" />
</TableRow>
</TableLayout>
但是如果我这样做,那么我就不会得到列表布局,并且表格布局位于左侧。我只是一个初学者,可能我做的完全错误。谁能指导我,很紧急......
最佳答案
您可以从 ScrollView 或 TableLayout 作为顶部父级开始。如果它是 TableLayout,那么您将需要 TableRow。
<TableLayout>
<TableRow>
{Add your ListView Here}
{Add your nested TableLayout here}
</TableRow>
</TableLayout>
由于没有 TableColumn 或 TableCell,它应该将 TableRow 中的每个子项视为一列。
关于android - 嵌套不同的布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5819908/