'How can I change android chip attributes in using Java
I am using android studio where I placed a chipGroup and programmatically adding chips inside. I am trying to change the chips witch, height & spacing but the attributes I assign have no effect when I run the app.
I generate and assign attributes like this:
ChipGroup lettersButtons = findViewById(R.id.letterButtons);
String[] letters = genABC();// Generates A-Z array
for (String letter : letters) {
Chip chip = new Chip(lettersButtons.getContext());
chip.setText(letter);
lettersButtons.addView(chip);
chip.setWidth(50);
chip.setHeight(50);
chip.setTextSize(16);
chip.setChipBackgroundColorResource(R.color.selectionButtons);
chip.setEnsureMinTouchTargetSize(false);
chip.setClickable(true);
chip.setEnsureMinTouchTargetSize(true);
chip.setCheckedIconVisible(false);
chip.setChecked(false);
chip.setOnClickListener(new View.OnClickListener() {...
Below are the letter chips and they do not obey the size definitions above. How can I change the chip width, height, round corners, spacing etc in this way?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
