Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to disable/edit the fading that a list view has at its edges?

Scrollable views such as the ListView have a fade out of the content along the edges where there is more content in that direction. How can I turn this fading off? I know you can change the cacheColorHint as discussed here: http://developer.android.com/resources/articles/listview-backgrounds.html but that is not what I am looking for and will not achieve what I am looking for in this case.

I want to disable the fade completely or be able to reduce the size and or transparency of it. Is this possible?

like image 365
cottonBallPaws Avatar asked Nov 09 '10 04:11

cottonBallPaws


People also ask

How do you stop a list item from responding to a user click?

view. setEnabled(false); Use this if you want to disable the listItem which user has clicked. Thus prevents the onclick event on that particular item.

Is ListView deprecated Android?

We've learned how to implement the ListView, bind the data with the adapter and how to improve scrolling using ViewHolder pattern. It's worth to mentioned that the ListView is a kind of deprecated because the RecyclerView was introduced with the API 21 (Android Lollipop).

What is the difference between RecyclerView and ListView in android?

Simple answer: You should use RecyclerView in a situation where you want to show a lot of items, and the number of them is dynamic. ListView should only be used when the number of items is always the same and is limited to the screen size.


3 Answers

I can't actually test it right now, but I believe fadingEdge is what you're looking for:

android:fadingEdge="none"

or

listView.setVerticalFadingEdgeEnabled(false);

http://developer.android.com/reference/android/view/View.html#setVerticalFadingEdgeEnabled(boolean)

like image 130
Kevin Coppock Avatar answered Oct 17 '22 12:10

Kevin Coppock


In case someone finds this via Google:

As mentioned, android:fadingEdge is deprecated. Use this instead:

android:overScrollMode="never"
like image 39
Christoph Bach Avatar answered Oct 17 '22 12:10

Christoph Bach


Late answer, but at this point to maintain backwards compatibility with API 13 and below, use both android:requiresFadingEdge="none" and android:fadingEdge="none" together.

like image 9
pqn Avatar answered Oct 17 '22 12:10

pqn