Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Change font of a Textview (navigation bar)

$
0
0

Hi there !
I wanted to have a navigation bar with a centered text and a custom font. After many hours I finally found a way to center the text in Android by adding a TextView in the toolbar.axml :

    <?xml version="1.0" encoding="utf-8"?>
    <android.support.v7.widget.Toolbar xmlns:android="hxxp://schemas.android.com/apk/res/android"
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?attr/colorPrimary"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        android:popupTheme="@style/ThemeOverlay.AppCompat.Light">

    <TextView
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="Awesome Title"
         android:layout_gravity="center"
         android:id="@+id/toolbar_title"
         android:fontFamily="Volkhov-Italic.ttf"
         />

    </android.support.v7.widget.Toolbar>

But I can't achieve to get my custom font working. I added it on the Asset folder I can access it with Xaml and behind-code to custom some label and others stuffs but not with the TextView I'm using as a Toolbar. Any idea ?

Thanks a lot !


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>