Android 布局中视图元素的左右对齐

发布于 2024-10-18 02:36:15 字数 51 浏览 5 评论 0原文

如何让视图将自己定位在 TableLayout 行的左侧、右侧和中心位置?还是线性布局?

How do you get a view to position itself left, right and center in a TableLayout row? Or linear layout?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

捎一片雪花 2024-10-25 02:36:15

您可以使用android:gravity属性来设置您想要的对齐方式。

<TableRow android:gravity="center">
    <LinearLayout android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:gravity="center">
    </LinearLayout>
</TableRow>

使用 TableLayout 时,请查找 steachColoum 属性。如果您希望所有表格列自动调整,也请加上*。

You can use the android:gravity property to set the alignment you want.

<TableRow android:gravity="center">
    <LinearLayout android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:gravity="center">
    </LinearLayout>
</TableRow>

When working on the TableLayout, look for the streachColoum property. Also make it * if you want all the table columns to auto fit.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文