Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
104 views
in Technique[技术] by (71.8m points)

android - Chip margin issue when I set isCloseIconVisible to false

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...