In this example, I’m going to share a simple tip to make custom vertical android ScrollView. Android has provided us lots of ScrollView attributes and with the help of these attributes, we can customize ScrollView in our own way.
Create a new Android Project
Let’s start by creating a new android project to customize android vertical ScrollView with following information.
Application Name: Custom Vertical ScrollView
Company Domain: viralandroid.com
Package Name: com.viralandroid.customverticalscrollview
Minimum SDK: Android 2.2 (API 8 Froyo)
Add ScrollView in XML Layout File
Look at the following code I have added scrollbarThumbVertical and scrollbarTrackVertical xml attribute to customize android ScrollView. Following is the final code of xml layout file.
XML Drawable Resource
Create two xml files vertical_scrollview_track.xml and vertical_scrollview_thumb.xml inside res/drawer and add following code.
Java Activity File
Your default java activity file looks like this.
Now, run your application. Your application looks like above screenshot.
Download Complete Example Project
Download complete Android Custom Vertical ScrollView Example project source code from GitHub.