android - 如何在 TableLayout 中创建三列

标签 android layout

我正在开发一个使用 TableLayout 的屏幕。在这里,我可以轻松地创建两列。但如何创建三列?

最佳答案

举个例子:

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:stretchColumns="1">
    <TableRow>
        <TextView
            android:text="first"
            android:padding="3dip" />
        <TextView
            android:text="second"
            android:gravity="center"
            android:padding="3dip" />
        <TextView
            android:text="third"
            android:gravity="right"
            android:padding="3dip" />
    </TableRow>

    <TableRow>
        <TextView
            android:text="first"
            android:padding="3dip" />
        <TextView
            android:text="second"
            android:gravity="center"
            android:padding="3dip" />
        <TextView
            android:text="third"
            android:gravity="right"
            android:padding="3dip" />
    </TableRow>
</TableLayout>

关于android - 如何在 TableLayout 中创建三列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8616194/

相关文章:

android - 我的应用程序编译和构建正常,但意外退出?

android - android 中的 Api rest 调用不起作用

android - 三星禁用包

android - 为什么即使在android :targetSdkVersion = "25"?中Uri.fromFile也没有问题

CSS div 在缩放时移动

android - WebView 未绘制,WARN/webcore(5336) : Can't get the viewWidth after the first layout

html - React Native - 输入顶部的标签

Java Swing 布局 block

Android 闹钟管理器通知晚了

android - 如何通过知道元素 id 滚动到 ScrollView 中的特定 View 元素