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".
精彩评论