####view
<android.support.v7.widget.SwitchCompat
android:id="@+id/Switch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textOff=""
android:text="Toggle Switch"
android:background="@android:color/transparent"
android:textColor="@color/secondary_text"
android:textOn=""
android:button="@null"
android:padding="20dp"/>
####activity/ fragment
swt = (SwitchCompat)findViewById(R.id.Switch);
swt.setOnCheckedChangeListener (this);
swt.setChecked (true);