After implementing a title and subtitle for my toolbar, the wrong font size is used for some reason. What needs to be done in order to fix this?
Java
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar customToolbar = (Toolbar)findViewById(R.id.toolbarC);
customToolbar.setBackgroundColor(Color.parseColor("#E21836"));
TextView mTitle = (TextView) this.findViewById(R.id.toolbar_title);
mTitle.setText("Hello World");
mTitle.setSingleLine(true);
TextView mSubtitle = (TextView) this.findViewById(R.id.toolbar_subtitle);
mSubtitle.setText("Hello World");
mSubtitle.setSingleLine(true);
}
}
toolbarC.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbarC"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:id="@+id/header_text_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00FFFFFF"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"/>
<TextView
android:id="@+id/toolbar_subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle"/>
</LinearLayout>
</android.support.v7.widget.Toolbar>
Found the problem and have solved it. There was a hidden duplicate of the toolbar text views within my project and the duplicate title & subtitle were what was shown to me when deploying my app.