AT&T Developer
  • Products
  • Resources
  • Blog
  • Sign In

Technical Library

    Device Technologies
    • Biometrics
    • Device Detection
    • HTML5
    • Mobile Web Fundamentals
    • Mobile Web Standards
    • Multi Core Coding in Dalvik
    • Multi Thread Coding in Android
    • Near Field Communication
    • NFC Forum
    • NFC Use Cases
    • NFC Case Studies
    • NFC Tags
    • GlobalPlatform and NFC
    • User Identification
    • Native Code
    Security and Privacy
    • Application Privacy Guidelines
    • Downloading DRM Content in Android
    • IPv6
    • Likelihood of a Successful Attack
    • Messaging Privacy
    • Mobile Web Security
    • Network Security
    • Security Policy
    • Security at AT&T
    • Types of Security Threats
    • Wireless Application Security
    • Security Policy Enforcement
    UI Elements
    • Slider Controls for Android
    • Check Box for Android
    • Dropdown for Android
    • Image Button for Android
    • Toggle Button for Android
    • Radio Button for Android
    • Segmented Text Toggle Button for Android
    • Static Text Toggle Button for Android
    • Switch for Android
    • Text Fields for Android
    • Getting Started with AT&T UI
    • HTML5 UI Elements
    • HTML5 Checkboxes
    • HTML5 Dropdown
    • HTML5 Image Button
    • HTML5 Image Toggle Button
    • HTML5 Radio Button
    • HTML5 Segmented Toggle Button
    • HTML5 Slider
    • HTML5 Static Text Toggle Button
    • HTML5 Switch Control
    • HTML5 Text Fields
    Network Technologies
    • IP Addresses
    • Long Term Evolution (LTE)
    • Network Timers
    • Wi-Fi
  • Other AT&T Websites
  • Best Practices
    • Hackathon Best Practices
    • Mobile Best Practices
    • Seven Common Errors Around Creating Mobile User Experiences
toggle menu

Slider Controls for AndroidTM

 

Slider UI elements enable users to set values by moving a scrubber to a position on a track.

Download UI elements for Android.

 

Configuration

 

Slider UI elements can appear in two different forms:

Continuous   The scrubber moves smoothly along the track – any position represents a valid input.
Segmented   The scrubber snaps to fixed positions along the track

 

Also it has the following variations

Point   No fill on the track.
Fill   Track fills with orange highlight.

 

 

Creation

 

You need to create a new com.att.widgets.lib.control.SliderControl object and add it to your view or layout.

 

Full layout code


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:att="http://schemas.android.com/apk/res/com.att.control"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:id="@+id/textFieldslider"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="This is a continuous Slider Control example."
android:textStyle="bold"
android:paddingBottom="10dp"/>
<com.att.widgets.lib.control.SliderControl
android:id="@+id/slider_bar_1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/textFieldslider"
att:max_value="100"
att:min_value="0"
att:divide_in="4"
att:current_value="5"/>
<TextView android:id="@+id/slide_bar_1_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/slider_bar_1"
android:text="Value: 10"
android:paddingBottom="10dp"/>
<TextView android:id="@+id/textFieldslider2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="This is a segmented Slider Control example."
android:textStyle="bold"
android:layout_below="@id/slide_bar_1_text"
android:paddingBottom="10dp"/>
<com.att.widgets.lib.control.SliderControl
android:id="@+id/slider_bar_2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/textFieldslider2"
att:max_value="100"
att:min_value="-100"
att:divide_in="4"
att:current_value="-50"/>
<TextView android:id="@+id/slide_bar_2_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/slider_bar_2"
android:text="Value: 10"
android:paddingBottom="10dp"/>
<TextView android:id="@+id/textFieldslider3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="This is a disabled Slider Control example."
android:textStyle="bold"
android:paddingBottom="10dp"
android:layout_below="@id/slide_bar_2_text"/>
<com.att.widgets.lib.control.SliderControl
android:id="@+id/slider_bar_3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/textFieldslider3"
att:max_value="20"
att:min_value="0"
att:divide_in="2"
att:current_value="5"/>
<TextView android:id="@+id/slide_bar_3_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/slider_bar_3"
android:text="Value: 10"
android:paddingBottom="10dp"/>
</RelativeLayout>

 

Activity

 

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import com.att.widgets.lib.control.SliderControl;
public class SliderControlActivity extends Activity implements OnClickListener{
private SliderControl slider_1, slider_2, slider_3;
private TextView sliderText_1, sliderText_2, sliderText_3;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
slider_1 = (SliderControl)findViewById(R.id.slider_bar_1);
slider_2 = (SliderControl)findViewById(R.id.slider_bar_2);
slider_2.setStep(50.0f);
slider_3 = (SliderControl)findViewById(R.id.slider_bar_3);
sliderText_1 = (TextView)findViewById(R.id.slide_bar_1_text);
sliderText_2 = (TextView)findViewById(R.id.slide_bar_2_text);
sliderText_3 = (TextView)findViewById(R.id.slide_bar_3_text);
slider_2.setProgressFillColor(true);
slider_3.setEnabled(false);
slider_1.setOnClickListener(this);
slider_2.setOnClickListener(this);
slider_3.setOnClickListener(this);
}
@Override
public void onClick(View v) {
if (v == slider_1) {
sliderText_1.setText("Value: " + slider_1.getCurrent());
} else if (v == slider_2){
sliderText_2.setText("Value: " + slider_2.getCurrent());
} else if (v == slider_3){
sliderText_3.setText("Value: " + slider_3.getCurrent());
}
}
}

 

Selected Value

This method returns the current selected value

slider.getCurrent()

 

Continuous and Segmented Configuration

If you use this method to set the step, then the slider will be segmented. Otherwise it will be continuous

 slider.setStep(50.0f);

 

Fill and Point Configuration

If you set

 slider.setProgressFillColor(true);

 

the slider control becomes a fill type slider. If this property is not set or if it is set to false, the slider type is 'point'.

 

Attributes

max_value max limit of Slider Control
min_value min limit of Slider Control
divide_in number of segments divided
current_value current bar value

Android is a trademark of Google Inc.

Back To Top
  • APIS & TOOLS
    • AT&T Video Optimizer
  • APIS & TOOLS
    • Futurist Reports
    • Technical Library
  • SUPPORT
    • Contact Us
    • FAQs
    • Twitter
  • AT&T Developer Program on Github
  • AT&T Developer Program on Facebook
  • AT&T Developer Program on Twitter
AT&T Logo

Terms of Use   Privacy Policy   Your Privacy Choices California Consumer Privacy Act (CCPA) Opt-Out Icon
©2025 AT&T Intellectual Property. All rights reserved

AT&T, the AT&T logo and all other AT&T marks contained herein are trademark of AT&T Intellectual Property and/or AT&T affiliated companies.

14100000
Session Expiring

Your session is about to expire in !

Stay Signed In
Session Expired

Sorry! Your session has expired.

Skip to content