I can achieve this center-aligned text on Android action bar 
with these codes:
Activity
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); getSupportActionBar().setCustomView(R.layout.custom_toolbar); } custom_toolbar.xml
<?xml version="1.0" encoding="utf-8" ?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Awesome App\nBlah Blah Blah" android:textStyle="bold" android:textSize="20dp" android:textColor="@color/gold_yellow" /> </LinearLayout> Of course, that means every activity shows the same title:
Awesome App
Blah Blah Blah
Is there a way to change the text on custom_toolbar.xml programmatically, so I can show different titles on different activities?