开发者

Prevent scrollbar from hiding on froyo

Starting with 2.2, scrollbars wo开发者_高级运维uld disappear once the scrolling has stopped.

Is there a way to make them always visible like before?


A helper method:

public static void disableScrollbarFading(View view) {
    try {
        Method setScrollbarFadingEnabled = View.class.getDeclaredMethod(
                "setScrollbarFadingEnabled", boolean.class);
        setScrollbarFadingEnabled.setAccessible(true);
        setScrollbarFadingEnabled.invoke(view, false);
    } catch (Exception e) {
        // OK, API level < 5
    }
}


What about View.setScrollbarFadingEnabled(boolean fadeScrollbars)? This is available since API level 5.


You can also set this in the xml with android:fadeScrollbars="false".

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜