On/Off Toggle Button in Preferences & Action Bar – Ice Cream Sandwich Style

I am referring to the blue ON/OFF styling as seen in the default Android Settings app on ICS phones. It can also be seen here: http://android-developers.blogspot.com/2012/02/android-design-v2-now-with-stencils.html
I want to put them in a Preference screen, would I have to use a custom preference widget?

Also, is it easy to put toggle buttons in the Action Bar? It seems to be possible since it is done for Wifi Settings in the default Android Settings on ICS, but it is probably a custom menu item?

  • Android Recycler view adapter filter with animation
  • Eclipse: multiple project from single source
  • Best Learning Resource for OAuth
  • How to solve Error: This attribute must be localized. (at 'text' with value 'TOP_LEFT')
  • Java annotation execute a method within the annotation declaration(usage for android)
  • koush AndroidAsync socket example
  • Any help is greatly appreciated.

    Related posts:

    ViewPager - get a partial view of the next page
    Why is FusedLocationApi.getLastLocation null
    why libcore.io.ErrnoException: kill failed: ESRCH (No such process) in android?
    Android: automatically choose debug/release Maps api key?
    Use DataBinding library to set background color resource or null
    com.google.gson.JsonSyntaxException when trying to parse Date/Time in json
  • Center text in a toast in Android
  • is it possible release an updated app by signing it with a different certificate than the one originally used
  • Facebook Android SDK ProfilePictureView caching
  • Change style of ProgressDialog
  • Default Settings launcher icon
  • Using custom behaviour to create multiple “anchor points”/positions for CollapsingToolbar
  • One Solution collect form web for “On/Off Toggle Button in Preferences & Action Bar – Ice Cream Sandwich Style”

    As easy as:
    My xml-v14/preferences.xml

        android:title="@string/feature_title" />

    For compatibility:
    My xml/preferences.xml

        android:title="@string/feature_title" />
    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.