[Chip] Chips are blinking in ChipGroup with custom font
See original GitHub issueDescription: I’m trying to update all Chip
s in ChipGroup
but they are blinking for a short time.
Expected behavior: Chips update without blinking.
Source code: Chips are created programmatically:
private fun createChip(context: Context, chipTitle: String): Chip {
return Chip(context)
.apply {
setTextAppearance(R.style.ChipTextStyle)
text = chipTitle
isClickable = false
isFocusable = false
setChipBackgroundColorResource(R.color.chipColor)
setTextColor(ContextCompat.getColor(context, R.color.black))
}
}
Style with custom font:
<style name="ChipTextStyle">
<item name="android:textSize">20sp</item>
<item name="android:textColor">@color/black</item>
<item name="android:fontFamily">@font/whitney_medium</item>
</style>
Update method:
private fun updateAllChips() {
chipGroup.removeAllViews()
val chipsTitles = listOf("Tag 1", "Tag 2", "Tag 3", "Tag 4")
chipsTitles.forEach { title ->
val chip = createChip(this, title)
chipGroup.addView(chip)
}
}
Full source code: link to repository
Android API version: 28, 27, 23
Material Library version: 1.1.0
Devices: Meizu 16th api 28, emulators (Nexus 5X api 27, Galaxy Nexus api 23)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:8 (3 by maintainers)
Top Results From Across the Web
How to change the typeface of Chip view? - android
I load chips programmatically and chip view blinks as it first loads default font, and after that my font. With many chips, it...
Read more >Android P: Chips and ChipGroup - DigitalOcean
Chips are basically a text displayed in a rounded background. ... This is how the chip looks on the screen: android chips default...
Read more >How To Change The Typeface Of Chip View - ADocLib
Chips allow users to enter information make selections filter content or trigger actions. ... [Chip] Chips are blinking in ChipGroup with custom font...
Read more >ChipGroup - Android Developers
A ChipGroup is used to hold multiple Chip s. By default, the chips are reflowed across multiple lines. Set the app:singleLine attribute to ......
Read more >[Solved]-Animate Chip checking in Material Chipgroup (Android)
For this option add the following custom Chip class (Kotlin) to your ... You can observe a flickering of adjacent chips during the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ymarian I wouldn’t say it is expected, because when I set custom font manually all works fine:
I also encountered the flickering issue in version
1.2.1
when using a custom font, I updated to the latest version1.4.1
, and the flickering is now gone 😃