控制衰落边缘的列表视图中的颜色视图、边缘、颜色、列表

2023-09-04 11:03:26 作者:诗酒趁年少...

我有一个主题,起源于Android的默认光的主题。我的列表视图配置有一个白色的背景,我想,作为这样的副作用,衰落边缘的颜色是白色的,这不是我想要的东西 - 我想他们是黑色的。

I have a theme that derives from Android's default light theme. My ListViews are configured with a white background, and I guess as a side-effect of this, the color of the fading edge is white, which is not something that I want - I'd like them to be black.

这似乎不可能简单地改变边缘的颜色(虽然我可以控制的长短等因素的影响),在某些pretty的可怕的副作用,使用黑色的ListView的暗示色彩效果通常的建议当列表滚动。

It seems impossible to simply change the color of the edge (although I can control the length and other factors), and the usual suggestion of using a black color for listview's hint color results in some pretty horrible side-effects when the list scrolls.

任何人都可以提出建议改变衰落边缘的颜色任意颜色的可靠方法是什么?

Can anyone advise a reliable way of changing the color of the fading edge to an arbitrary color?

推荐答案

不幸的是,你不能很容易地做到这一点。衰落边缘的全部意义在于隐藏在后台,不画出一些随机的颜色。但是,您可以尝试扩展ListView和覆盖getSolidColor()返回你想要的颜色的褪色边缘。它应该只是罚款。

Unfortunately you cannot do this easily. The whole point of the fading edges is to fade into the background, not to draw some random color. However, you can try to extend ListView and override getSolidColor() to return the color you want for the fading edges. It should work just fine.