试试这个,
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);
}
如果它的工具栏意味着尝试像如下。
<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>
然后只需通过编程方式使用下面的评论添加任何样式。使用样式
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
TextView mTitle = (TextView) toolbar.findViewById(R.id.title);
OR
变化。需要一个信息click here。
你的意思是在'ActionBar'中改变应用程序的标题吗? –
是的,我正在编辑这个问题。 – anilbey