--ADVERTISEMENT--

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.

Android Custom Vertical ScrollView Example


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.

Download Complete Example Project

Download complete Android Custom Vertical ScrollView Example project source code from GitHub.

Post a Comment

Powered by Blogger.