NativeScript: how to use android.support.v7.widget.SwitchCompat on Android 4 -


is there way use material appcompat switch on android 4? if so, please give example of usage in nativescript.

i made little research , found there no easy way use material design switch version lower 5. switch component available api v7 has been described here. change basic style properties accessing android property. attaching sample code:

main-page.xml

<page xmlns="http://schemas.nativescript.org/tns.xsd" loaded="load">   <stacklayout>   <switch id="test" checked="{{ checked }}" class="style"   />    </stacklayout> </page> 

main-page.js

function load(args) {     var page = args.object;     var tmpswitch = page.getviewbyid("test");     tmpswitch.android.setshowtext(false);     tmpswitch.android.setswitchminwidth(15); } exports.load = load;