Reputation: 2938
I'm trying to use this code:
actionToggleButton=new ToggleButton(context);
actionToggleButton.setTextOn(null);
actionToggleButton.setTextOff(null);
But I'm still getting the default text! How can I clear it? Thanks.
Upvotes: 1
Views: 2420
Reputation: 17895
You can also do this in XML via the textOn
and textOff
attributes:
<ToggleButton
android:id="@+id/toggle_filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textOn="@null"
android:textOff="@null"/>
Upvotes: 2
Reputation: 86948
Try this:
ToggleButton button = new ToggleButton(this);
button.setText(null);
button.setTextOn(null);
button.setTextOff(null);
Upvotes: 2