gpt4 book ai didi

android - 我们如何设置列的内容以在表格布局中换行

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:43:15 25 4
gpt4 key购买 nike

我正在尝试这种表格布局,其中有三列,每列尽可能利用最大空间(使用 strechColumn 标记)。现在,当列的内容太长时,表格布局会跳出屏幕。

如何将列的内容设置为换行,以便表格布局不会跳出屏幕。

这是我使用的表格布局的 XML 代码

<?xml version="1.0" encoding="utf-8"?>

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:scrollbars="vertical"
android:layout_height="fill_parent"
android:layout_width="fill_parent">

<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="0,1,2"
android:id="@+id/tLayout"
android:scrollbars="vertical"
>
<TableRow
android:layout_width="fill_parent">
<TextView
android:padding="3dip"
android:gravity="left"
android:text="Name"
/>
<TextView
android:padding="3dip"
android:gravity="left"
android:text="Address"
/>
<TextView
android:padding="3dip"
android:gravity="left"
android:text="Age"
/>
</TableRow>
</TableLayout>
</ScrollView>

最佳答案

您可以在TableLayout 中指定相应的android:shrinkColumns

关于android - 我们如何设置列的内容以在表格布局中换行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2362670/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com