Android Custom Vertical ScrollView Example
https://www.viralandroid.com/2015/09/android-custom-vertical-scrollview-example.html
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.
Related:
Android Custom Horizontal ScrollView Example
Android Action Bar Tutorial and Example With Option Menu
Navigation Drawer View User Interface (UI) Design for Android
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)
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.
res/layout/activity_main.xml
Create two xml files vertical_scrollview_track.xml and vertical_scrollview_thumb.xml inside res/drawer and add following code.
res/drawer/vertical_scrollview_track.xml
res/drawer/vertical_scrollview_thumb.xml
Your default java activity file looks like this.
src/MainActivity.java
Now, run your application. Your application looks like above screenshot.
Related:
Android Custom Horizontal ScrollView Example
Android Action Bar Tutorial and Example With Option Menu
Navigation Drawer View User Interface (UI) Design for Android
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.
res/layout/activity_main.xml
XML Drawable Resource
Create two xml files vertical_scrollview_track.xml and vertical_scrollview_thumb.xml inside res/drawer and add following code.
res/drawer/vertical_scrollview_track.xml
res/drawer/vertical_scrollview_thumb.xml
Java Activity File
Your default java activity file looks like this.
src/MainActivity.java
Now, run your application. Your application looks like above screenshot.