gpt4 book ai didi

android - ListView 的背景颜色百分比

转载 作者:行者123 更新时间:2023-11-30 02:45:18 24 4
gpt4 key购买 nike

是否可以使用百分比因子为 Listview 元素的背景着色?例如,如果我在 Listview 中有 3 个元素,其中一个有 2 个点,另一个只有一个:

A:2分---->66.6666666%

B:1分---->33.3333333%

C:0分---->0%

我可以用某种方式给背景上色吗,就像这样?

A|---------------- |

乙|------ |

C| |

最佳答案

您可以尝试使用 ClipDrawable并在列表适配器的 getView() 中设置可绘制对象的级别。

关于android - ListView 的背景颜色百分比,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25142087/

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