开发者

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?

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


To do it dynamically use the method .setVerticalFadingEdgeEnabled()

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


in android xml layout of scroll view

android:fadingEdge="none"

ad this


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜