gpt4 book ai didi

android - 如何将标题添加到多列 ListView

转载 作者:行者123 更新时间:2023-11-29 22:33:05 24 4
gpt4 key购买 nike

我在这个论坛上找不到这个问题。时间不多了。

我有一个包含三个 TextView 的多列 ListView。我需要为每一列添加标题。我正在使用 Android 1.5 SDK。

有人可以帮助我吗?我不能使用 addHeaderView,因为它只添加一个只包含一个标题字符串的 View 。

谢谢奈恩

最佳答案

一个简单的解决方案是对标题使用与列表项相同的布局参数。例如:

If you have three TextViews, suppose 1st one is right aligned, 2nd one is to the left of this and 3rd one is to the left of second one. Now for the header as you have separate headers for each column, you can use the same layout params for the three column headers i.e 1st one is right aligned, 2nd one is to the left of this and 3rd one is to the left of second one.
This is just an eg. the basic idea is to keep layout params(relative position,margins,padding,etc) same for both of them.

我试过了,它对我有用。

关于android - 如何将标题添加到多列 ListView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3110949/

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