the_prole
the_prole

Reputation: 8985

How to set scroll bar visibility to true within a custom style

This is how I set up my scroll bar. I insert this attribute in my listView.

android:scrollbarThumbVertical="@drawable/scroll_style_custom"

Then I customize the scrollbar with a custom_scrollbar_style.xml in my drawables

<gradient
    android:angle="45"
    android:endColor="#FF3401"
    android:centerColor="#ff5c33"
    android:startColor="#FF3401" />

<corners android:radius="8dp" />
<size android:width="20dp"/>
<padding
    android:left="0.5dp"
    android:right="0.5dp" />

Now how do I set scroll bar visibility to true with my xml file?

Basically I want the equivalent of this but with a custom style

listView.setFastScrollAlwaysVisible(true);

Or is this only possible by setting another attribute in the list view?

Upvotes: 1

Views: 463

Answers (1)

piotrek1543
piotrek1543

Reputation: 19361

As of now the best way is to use android:fadeScrollbars="false" in xml which is equivalent to ScrollView.setScrollbarFadingEnabled(false); in java code.

If both of them doesn't work, you can instead of them use android:scrollbarFadeDuration="0"

Hope it help

Upvotes: 1

Related Questions