Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change the width/thickness of a scrollbar?

Currently this is my scrollbar.xml file:

<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" >      <gradient         android:angle="45"         android:centerColor="@color/blue"         android:endColor="@color/blue"         android:startColor="@color/blue" />      <corners android:radius="8dp" />  </shape> 

And this is my ScrollView:

<ScrollView     android:id="@+id/scrollView1"     android:scrollbarThumbVertical="@drawable/scrollbar"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:layout_alignParentBottom="true"     android:layout_alignParentLeft="true"     android:layout_alignParentRight="true"     android:layout_below="@+id/btnBack" > 

This is the scrollbar it gives me. It's good, except it's too thick and obvious. It may not look thick in this screenshot, but it really is.

enter image description here

Am I able to set a ScrollView property to adjust the width/thickness of the scrollbar? Or can I put a property in my gradient?

like image 437
Michael Yaworski Avatar asked Dec 26 '13 09:12

Michael Yaworski


People also ask

How do I adjust the scrollbar width?

How to Customize the Scrollbars Width to be Narrower or Wider. If you want to change the scroll width too (or only the scroll width), you'll find it just under ScrollHeight in the right pane. So double-click/tap on the ScrollWidth to open the Edit String window.

How do I make my scrollbar thinner CSS?

auto is the default value and will render the standard scrollbars for the user agent. thin will tell the user agent to use thinner scrollbars, when applicable. none will hide the scrollbar completely, without affecting the element's scrollability.

What is the width of scrollbar?

The scrollbar-width property is used to set the width or thickness of an element's scrollbar when shown. This property can be used on pages where the user interface requires the element to be displayed more prominently and shrinking the scrollbar width gives more space to the element.

How do I change the scrollbar width in Chrome?

Once you have installed this extension on your Chrome browser, click on its extension icon present on the top right part of the Chrome browser. This will open the Options or Settings page of this Chrome extension. On the Options page, you will see a slider for Scrollbar Size.


2 Answers

add the following property to your layout

android:scrollbarSize="50dip" 
like image 159
Dehan Wjiesekara Avatar answered Oct 03 '22 03:10

Dehan Wjiesekara


see the android:scrollbarSize="" attribute of ScrollView.

<ScrollView     android:id="@+id/scrollView1"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:layout_alignParentBottom="true"     android:layout_alignParentLeft="true"     android:layout_alignParentRight="true"     android:layout_below="@+id/btnBack"     android:scrollbarSize="4dp"     android:scrollbarThumbVertical="@drawable/scrollbar" > 
like image 27
Gopal Gopi Avatar answered Oct 03 '22 05:10

Gopal Gopi