mobile - Can I use Android L switch control theme in android 4.0 -


I want to know, can I use the Android L switch control theme on Android 4.0? For example please.

Thanks, A

  1. * * 1.) Create a new project by file-> new-> Android project name, this switches example. 2.) Write the following in the main.xml: **

      Switch Android: text = "standard switch" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" android: layout_marginbottom = "32dip" /> & Lt; Android: layout_height = "wrap_content" Android: layout_marginBottom = "32dip" /> & Lt; Android: layout_height = "wrap_content" android: layout_marginBottom = "32dip" /> gt; & Lt; Android: textOn = "Start" Android: textOn = "Start" Android: textOff = "Stop" android: layout_marginBottom = "32dip" /> & Lt; / LinearLayout & gt; & Lt; / Scrollview & gt;  

    3.) Run for the output. Step: 1.) Create a project for switches example and set the information stated in the image. Create Goal: Android 4.0 Application Name: SwitchesExample Package Name: Com. Examples. SwitchesExample Activity Name: SwitchesExample Min SDK Version: 14

    2) Open SwitchesExample.java file and type the following code there: package com.example.SwitchesExample;

    Import android.app .. Activity; Importroid.os.Bundle; Import android.widget.CompoundButton; Import android.widget.Switch; Import android.widget.Toast;

    Public class SwitchesExample implements the expanded activity CompoundButton.OnCheckedChangeListener {@Override Protected Zero OnCreate (bundled savedInstanceState) {super.onCreate (savedInstanceState);

      SetContentView (R. Layoutman); Switch s = (Switch) ViewById (R.id.monitored_switch); If (s! = Null) {s.setOnCheckedChangeListener (this); }} @Override Public Zero onCheckedChanged (CompoundButton buttonView, Boolean isChecked) {Toast.makeText (this is "Monitor Switch" + (isChecked "on": Toast.LENGTH_SHORT "Closed"),) .show (); }}  

    3 compile and build the project.


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -