I am creating Chips dynamically and everything is working fine but when I set isCloseIconVisible
and add the chip to ChipGroup then there is some kind of empty space(like margin not padding) at start of chip.
How can I resolve that? Any help will be appreciated
This is how I am creating Chip
fun createChip(context: Context, text: String, closeIconVisible: Boolean = true): Chip {
val chip = Chip(context)
chip.text = text
chip.setChipDrawable(ChipDrawable.createFromAttributes(context, null, 0,
R.style.Widget_MaterialComponents_Chip_Entry))
chip.setChipBackgroundColorResource(android.R.color.transparent)
chip.isCheckedIconVisible = false
chip.setTextColor(context.getColor((R.color.theme_primary)))
chip.setCloseIconTintResource(R.color.theme_primary)
chip.setBackgroundResource(R.drawable.style_rectangle_border)
chip.setChipStrokeColorResource(R.color.theme_primary)
chip.chipStrokeWidth = ProductConstants.CHIP_STROKE_WIDTH
chip.isCloseIconVisible = closeIconVisible
chip.isEnabled = closeIconVisible
return chip
}
question from:
https://stackoverflow.com/questions/65918878/chip-margin-issue-when-i-set-iscloseiconvisible-to-false 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…