Reputation: 19723
I want to make the vertical scroll bar permanently visible. Currently the scroll bar appears only when I attempt to scroll the text view enclosed inside the scroll view. This is my XML declaration.
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@id/radio_group"
android:layout_margin="5dp"
android:scrollbars="vertical"
android:scrollbarAlwaysDrawVerticalTrack="true" >
<TextView
android:id="@+id/question"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:textColor="#FF000000"
android:textStyle="bold" />
</ScrollView>
Thank you for your time.
Upvotes: 22
Views: 29691
Reputation: 61
We can do it in 2 different ways as shown below.
Method 1: in your XML
android:scrollbars="vertical"
android:fadeScrollbars="false"
Method 2: in your Java Code
editText.setVerticalScrollBarEnabled(true);
editText.setVerticalscrollbarFading(false);
Upvotes: 5
Reputation: 15267
View.setScrollbarFadingEnabled(boolean) seems to be what you're looking for (never tried it though). Here View
is the ScrollView
on which you want the scrollbars to not fade. And set the boolean value to be false
.
Upvotes: 2
Reputation: 5295
if you do it dynamically, it shows runtime error and the scroll is not visible
EditText edit = (EditText) find ViewById(R.id.EditText1);
edit.setVerticalScrollBarEnabled(true);
edit.setVerticalscrollbarFading(false);
there is no way to show it dynamically
Upvotes: 0