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

Static Text Toggle Button for Android™

 

The Static Text Toggle Button UI component is like a Static Text Button UI element except that after it is pressed it remains active until it is pressed again. It has four states: enabled, pressed, active, and disabled.

Download UI elements for Android.

 

Creation from XML

 

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

<com.att.widgets.lib.button.StaticTextToggleButton
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Static Text Toggle Button"
/>

 

Creation from Code

 

package com.att.test;
import android.app.Activity;
import android.os.Bundle;
import android.view.ViewGroup;
import com.att.widgets.lib.button.StaticTextToggleButton;
public class StaticTextToggleButtonActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
StaticTextToggleButton toggleButtonDisabled = (StaticTextToggleButton) findViewById(R.id.toggle_disabled);
toggleButtonDisabled.setEnabled(false);
StaticTextToggleButton toggleButton = new StaticTextToggleButton(this);
toggleButton.setText("Toggle Button added by code");
ViewGroup view = (ViewGroup) findViewById(R.id.toggle_button_main);
view.addView(toggleButton);
}
}

 

Full Layout Code

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10sp"
android:id="@+id/toggle_button_main"
>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="This is a Static Text Toggle Button"
/>
<com.att.widgets.lib.button.StaticTextToggleButton
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Static Text Toggle Button"
android:id="@+id/toggle_enabled"
android:layout_marginTop="5dip"
/>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="This is a disabled Static Text Toggle Button"
android:layout_marginTop="10dip"
/>
<com.att.widgets.lib.button.StaticTextToggleButton
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Disabled Static Text Toggle Button"
android:id="@+id/toggle_disabled"
android:layout_marginTop="5dip"
/>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="This is a Static Text Toggle Button created in code"
android:layout_marginTop="10dip"
/>
</LinearLayout>

 

Disabled State

 

To disable the text toggle button, set the enabled property to false.

toggleButtonDisabled.setEnabled(false);

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