Eugene
Eugene

Reputation: 60184

How to disable or change color for black rows while ListView scrolling

Colleagues, please advice how can I or remove these black lines which appears on ListView scrolling (see screenshot) either disable them? alt text

Upvotes: 1

Views: 1582

Answers (3)

hackbod
hackbod

Reputation: 91331

Please don't just turn this off. It is an important UI feature for the user to know there is more content above and/or below the list, and turning it off makes your UI behave inconsistently with the rest of the platform.

If you want to have a custom background color, the best way to do this is to make your own theme that sets it. This way when a preview is needed to be shown of your app it will better match your actual UI, and the theme will automatically take care of using this color for things like fades. Here is an example of what you could put in a res/values/styles.xml file, making such a theme which you can set for your application or an individual activity with android:theme="@style/CustomTheme".

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="custom_theme_color">#b0b0ff</color>
    <style name="CustomTheme" parent="android:Theme.Light">
        <item name="android:windowBackground">@color/custom_theme_color</item>
        <item name="android:colorBackground">@color/custom_theme_color</item>
    </style>
</code>

(Sorry about the syntax being a little odd -- it is because android:windowBackground currently can only be given a reference to a resource, not a constant color.)

For a list of the attributes you can use when declaring a theme, see:

http://developer.android.com/reference/android/R.styleable.html#Theme

Upvotes: 2

jcuenod
jcuenod

Reputation: 58405

To do it dynamically use the method .setVerticalFadingEdgeEnabled()

Or, in your XML Layout you can use the tag android:fadingEdge="none" (credit to nicky)

Upvotes: 3

nicky
nicky

Reputation: 3908

in android xml layout of scroll view

android:fadingEdge="none"

ad this

Upvotes: 2

Related Questions