question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BadgeDrawable] cannot use a custom typeface

See original GitHub issue

I’ve used the badge drawable for bottom navigation view. unfortunately, the typeface of the number badge cannot be changed and also it does not obey the fontFamily attr that was defined in AppTheme. Please add an API to use text appearance or style for it.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:11
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
MHKalantariancommented, Nov 2, 2020

Changing android:textAppearance font family doesn’t affect the number text, it only affects the text after the app:maxCharacterCount but the textSize applies to both. It’s really confusing

<style name="Widget.MyTheme.Badge" parent="Widget.MaterialComponents.Badge">
     <item name="android:textAppearance">@style/TextAppearance.MyTheme.Badge</item>
 </style>

 <style name="TextAppearance.MyTheme.Badge" parent="TextAppearance.MaterialComponents.Badge">
     <item name="android:textSize">10sp</item>
     <item name="fontFamily">@font/font_fa</item>
     <item name="android:fontFamily">@font/font_fa</item>
 </style>
1reaction
KhunHtetzNaingcommented, Mar 24, 2022

It’s still 2022?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change BadgeDrawable Typeface in Android - Stack Overflow
I need to use a custom font for BadgeDrawable appears on top of my bottom navigation bar item. So I created a custom...
Read more >
BadgeDrawable - Android Developers
You can use BadgeDrawable to display dynamic information such as a number of pending ... Badge and a custom style attribute are supported....
Read more >
BadgeDrawable does not appear on elements other than ...
Use the code from this answer and the xml from this answer FrameLayout frameLayout = findViewById(R.id.frameLayout) ImageView imageView = findViewById(R.id.
Read more >
android.util.AttributeSet#getStyleAttribute - ProgramCreek.com
setTypeface (Typeface.DEFAULT_BOLD); if (isInEditMode()) { // cannot use a drawable in edit mode, so setting the background color instead // of a background ......
Read more >
Adding Badge count on menu items like cart , notification etc
We can create badge count using either a custom view or by adding a ... Create a custom drawable let us called BadgeDrawable....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found