Skip to content

Conversation

@ViduraPrasangana
Copy link

Now each toggle button can hold deferent width.
Change width from these XML attributes

  • custom:widthToggleCenter"
  • custom:widthToggleLeft"
  • custom:widthToggleRight"
    Dynamically width can be supplied from giving ArrayList<Float> with all widths
ToggleSwitch toggleSwitch = (ToggleSwitch) findViewById(R.id.multiple_switches);
ArrayList<String> labels = new ArrayList<>();
ArrayList<Float> sizes = new ArrayList<>();
labels.add("AND");
labels.add("OR");
labels.add("XOR");
labels.add("NOT");
labels.add("OFF");
sizes.add(80f);
sizes.add(100f);
sizes.add(120f);
sizes.add(-1f);  //Default width fromo toggleWidth
sizes.add(-1f);  //Default width fromo toggleWidth
toggleSwitch.setLabels(labels,sizes);

toggleSwitch.setLabels(labels); method still available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant