java - Changing the font of the application title in android -


i have typeface, want change font of action-bar title in android. there way set title typeface that?

this.settitle(mytitle.touppercase());  this.settypefaceoftitle(tf); 

this not copy question, methods on link (how set custom font in actionbar title?) not working. when try them, eclipse gives error : java.lang.nosuchmethoderror

try this,

    int actionbartitle = resources.getsystem().getidentifier("action_bar_title", "id", "android"); textview actionbartitleview = (textview) getwindow().findviewbyid(actionbartitle); typeface robotoboldcondenseditalic = typeface.createfromasset(getassets(), "fonts/roboto-boldcondenseditalic.ttf"); if(actionbartitleview != null){     actionbartitleview.settypeface(robotoboldcondenseditalic); } 

if it's toolbar means try below.

<android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_height="wrap_content" android:layout_width="match_parent" android:minheight="?attr/actionbarsize" android:background="@color/action_color” app:theme="@style/toolbartheme" >    <textview     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="title"     android:layout_gravity="center"     android:id="@+id/title_txt” />   </android.support.v7.widget.toolbar> 

then add style via programmatically using below comment.

toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); textview mtitle = (textview) toolbar.findviewbyid(r.id.title); 

or

change using style. need 1 info click here.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -