Search code examples
androidstylesandroid-5.0-lollipopandroid-toolbar

Android Toolbar style


I've added a Toolbar to my Lollipop project. However, I'm having trouble styling the Toolbar. My title in the Toolbar appears to have a bold font, but I'd like it to be italic. Any idea how to achieve this? I've tried playing around with the actionbar-style, no luck.

I've set a style on the Toolbar with app:theme="@style/toolbar" and my @style/toolbar (parent ThemeOverlay.AppCompat.ActionBar) is where I'm playing around with no good results.


Solution

  • You can add TextView inside Toolbar, for example :

    <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/re/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/toolbar"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:minHeight="?attr/actionBarSize"
        android:background="?attr/colorPrimary" >
    
        <TextView
            android:id="@+id/title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textStyle="italic" />
    
    </android.support.v7.widget.Toolbar>