Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom width to each toggle button #45

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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