My application will run on api level 9 devices or higher. Now i have a toggle_button on one of the layouts. I want to change this toggle button to switcher if the device is apilevel 14 or higher. How can i implement this? Sorry for my english.
Implementing (switch\toggle button) depending on API level
1k views Asked by Valentin Baryshev At
2
There are 2 answers
0
On
I have found a solution! link
It just adds a support library. And you can use switchers from api-level7!
If you are creating the content/pages in xml, simply copy your xml with same name but to the
layout-v14
folder. Then change ToggleButton to SwitchButton, and Android will take care of rest :)If you are coding it in jave, use:
And when you'll want to use both (when using defining in xml) with the same java code use: