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.

Calligraphy does not work with NavigationView

See original GitHub issue

I tried to change it using Calligraphy configs but didn’t work CalligraphyConfig.initDefault(new CalligraphyConfig.Builder() .setDefaultFontPath("fonts/Roboto-RobotoRegular.ttf") .setFontAttrId(R.attr.fontPath) .build());

Also, I tried to get the menu from the NavigationView navigationView.getMenu() and use CalligraphyTypefaceSpan to set the title with no luck!

Is there anyway to achieve that?

Thanks in advance

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:4
  • Comments:21 (7 by maintainers)

github_iconTop GitHub Comments

10reactions
jzeferinocommented, Jan 28, 2018

I ended-up hacking the drawer menu to force the font when the DrawerStateChanged: See the source code here:

https://gist.github.com/jzeferino/797c5e6b72c666b6f87969f6146a2a6e

2reactions
marlonlomcommented, Jan 28, 2018

@jzeferino Great tip! But, i realized that when the activity is resumed or when configuration changes, it uses the default font. In that case, it work when close and reopen the navigationview (eg. when the app is restarted or something related to configuration change while nav-view its opened).

Finally, i ended up using this approach:

(1) in strings.xml:

    <style name="AppTheme.NavigationView">
        <item name="android:textSize">16sp</item>
        <item name="fontPath">fonts/Custom-font.ttf</item>
    </style>

(2) in activity_home.xml:

<android.support.design.widget.NavigationView
        android:id="@+id/home_navigation_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:theme="@style/AppTheme.NavigationView"
        app:menu="@menu/menu_drawer" />

Taken from here

Read more comments on GitHub >

github_iconTop Results From Across the Web

Calligraphy uses default system font after applying custom ...
I have defined the following style which is used as app:itemTextAppearance of NavigationView . Now the text size is changed but uses the ......
Read more >
Navigation View Problems | Apple Developer Forums
I've got multiple pages / views in my app (using Swift UI). But after I have navigated to my third view using navigation...
Read more >
Frequently Asked Questions - Calligraphy Pens
FAQS. I AM LEFT HANDED, WHAT NIBS CAN I USE? If you are left handed, we have a versatile range of calligraphy products...
Read more >
Navigation in SwiftUI 4: NavigationView, NavigationLink ...
Navigation in SwiftUI is very different than it is in UIKit. Read more to discover the different forms of navigation in SwiftUI.
Read more >
SwiftUI Navigation - NavigationView & NavigationLink Tutorial
Your browser can't play this video. ... you how to navigate between screens in your SwiftUI app using NavigationView and NavigationLink.
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