how to change color of the actual scroll in ScrollView android?
AndroidAndroid LayoutScrollviewAndroid XmlAndroid Problem Overview
I'm wondering if it's possible to change the color of the ScrollView.
I'm not referring to the background color or the edges.
I attached a print screen of the bar I'm referring. For me, it's kind of transparnt.
Here's how I defined it in the xml:
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fadeScrollbars="false"
android:layout_toLeftOf="@+id/personalscores_BackButton"
android:layout_marginRight="0dp" >
Android Solutions
Solution 1 - Android
Create a scroll bar in drawable(scrollbar.xml) using this
<shape android:shape="rectangle"
xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="45"
android:centerColor="#65FF8215"
android:endColor="#87FD2125"
android:startColor="#65FF8215" />
<corners android:radius="20dp" />
</shape>
and add this scroll bar like android:scrollbarThumbVertical="@drawable/scrollbar"
to your ListView
OR
put the following attribute to your layout
android:scrollbarThumbVertical="@android:color/white"
OR
create a image and put it in drawable. then add the following property to your layout
android:scrollbarThumbVertical="@drawable/scroll_bar_vertical"
Solution 2 - Android
put the following attribute to your layout
android:scrollbarThumbVertical="@android:color/white"
or create a image and put it in drawable. then add the following property to your layout
android:scrollbarThumbVertical="@drawable/scroll_bar_vertical"
Solution 3 - Android
Taken from this question:
You can set Listview property as or put the following attribute to your scrollview:
android:scrollbarThumbVertical="@drawable/custom_scroll_style"
Here custom_scroll_style is a xml file under the drawable folder. Lets create the custom_scroll_style.xml.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:angle="45"
android:endColor="#FF3401"
android:centerColor="#ff5c33"
android:startColor="#FF3401" />
<corners android:radius="8dp" />
</shape>
Solution 4 - Android
Try this beautiful custom scrollview
Add following tags in your scrollview
android:fadeScrollbars="false"
android:scrollbarStyle="insideInset"
android:scrollbarThumbVertical="@drawable/scrollview_thumb"
android:scrollbarTrackVertical="@drawable/vertical_scrollview_track"
Create following drawable in your drawable folder
scrollview_thumb.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/common_google_signin_btn_text_light_focused" />
<corners android:radius="15dp" />
</shape>
vertical_scrollview_traack.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#E2E0EB" />
<stroke
android:width="1dp"
android:color="#b3a9a9" />
<size android:width="15dp" />
<corners android:radius="15dp" />
</shape>
Output
Solution 5 - Android
The question is: "how to change color"
The only correct answer is one! code line in your layout:
android:scrollbarThumbVertical="@android:color/white"
Thats all!
p.s. The question is simple: "color"! and the answer is very simple too. Not a: "how to set custom bar", "how to change bar sizes" or etc. Why so many long answers...