How to set "android:scrollbars=vertical" programmatically?

I was looking for a method to do this programatically, too.

Seems from http://developer.android.com/reference/android/view/View.html#attr_android:scrollbars it's not possible, cause no related method is mentioned there.

The only method that sounds good by description is:

View.setVerticalScrollBarEnabled(boolean)

but in my case it didn't work. But that may depend on the layout and the way it is used.

I am thinking now about having two layouts: one with the attribute set to "none" and one set to "vertical". Then in code I could decide which to use.

Tags:

Android