Вы можете использовать программу для этого. Я не думаю, что какой-либо атрибут в Switch XML может помочь вам.
но, может быть, это поможет вам:
switchCompat.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if (b==true){
//when Switch is On
finalSwitchCompat.setTrackTintList(ColorStateList.valueOf(Color.GRAY));
finalSwitchCompat.setThumbTintList(ColorStateList.valueOf(Color.GRAY));
}
else {
finalSwitchCompat.setTrackTintList(ColorStateList.valueOf(Color.WHITE));
finalSwitchCompat.setThumbTintList(ColorStateList.valueOf(Color.WHITE));
}
}
});