Reputation: 969
I have built a test application in Android with minimum API level as 8 in which I want to implement the following :
I have a toggle button which looks somewhat like this :
This as you know is the default design of toggle buttons in API level 8. But I want my UI to be adaptive to the API level the application is running in. So in case the same app is running on Ice Cream Sandwhich (API level 15) , the same toggle button should look like this :
Does android provide any means to support this feature without building different a apk for each API level?
Upvotes: 2
Views: 625
Reputation: 39538
Edit
You have to use different layout that you will put in different layout folder.
For the api level 8 (and above), put it in
/res/layout-v8 and use the ToggleButton class: http://developer.android.com/guide/topics/ui/controls/togglebutton.html
For the level 15:
/res/layout-v15 and use a Switch class.
Good readings for you: http://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources
Upvotes: 3