Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
632 views
in Technique[技术] by (71.8m points)

android - Controlling the color of the fading edge in ListViews

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.

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It's actually much easier then that.

You can change the colour of the fade to anything you want using the: 'android:cacheColorHint' setting.

eg:

<ListView
....
android:cacheColorHint="#FFFFFF"
/>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.8k users

...