gpt4 book ai didi

android - 如何在android中设置gridview的列宽?

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:17:21 25 4
gpt4 key购买 nike

我在 android 中使用 gridview,我想设置第一列的宽度,但我不能。当我试图找到问题的答案时,我遇到了一条评论,如下所示。我的问题是下面的描述是真的吗?

GridView 中的所有列都具有相同的大小。在 2009 年 5 月 23 日星期六晚上 9:25,solid 写道:

I am having trouble controlling the size of the columns in my GridView. The first column is only 3-4 chars and the other 4 columns are 5-8 chars. For some reason, all the columns are the same width, leaving a huge amount of spacing after the first column and wrapping the text inside the others. Is there a way, I can set the width of individual columns in the grid view? In an ideal world, gridview would work like an html table, where the smaller columns are shrunk to fit the data and larger columns expand as necessary. Any ideas would be helpful.

最佳答案

您可以直接在您的布局资源文件中写入。

  android:columnWidth="100dp"

https://developer.android.com/guide/topics/ui/layout/gridview.html

关于android - 如何在android中设置gridview的列宽?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6789121/

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