Reputation: 9364
I'm looking to have the same design for Pre-Lollipop devices.
In my application I'm using a switch button which is looking like this on Lollipop devices :
and on Pre-Lollipop devices. it's looking like this :
So how can I do that I have two styles folders :
my Styles xml looks like :
<resources>
<style name="MyMaterialTheme" parent="MyMaterialTheme.Base">
</style>
<style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="windowActionModeOverlay">true</item>
<item name="actionModeBackground">@color/colorPrimaryDark</item>
</style>
<style name="MyMaterialTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="MyMaterialTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
Upvotes: 0
Views: 364
Reputation: 312
For switch you need to use the new android.support.v7.widget.SwitchCompat
More info here
Upvotes: 1
Reputation: 8231
You could use the SwitchCompat
class instead of Switch
to provide backwards compatibility.
Upvotes: 3