开发者

Prevent scrollbar from hiding on froyo

开发者 https://www.devze.com 2023-01-19 05:04 出处:网络
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:

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

精彩评论

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