I am creating a switch button programmatically. The problem I have is that the button does not show the ON / OFF
text. This is the creation code:
final RelativeLayout.LayoutParams ll = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
ll.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
sw.setLayoutParams(ll);
sw.setTextOn(values[0].getName());
sw.setTextOff(values[1].getName());
values[0].getName() returns "OK", and values[1].getName() returns "NOK"
What may be going on?
Thanks Jaime
You can do this through XML
<Switch
...
android:showText="true" />
Or Programatically as
mSwitch.setShowText(true);