please check the image that shows the displayed outputI have created a fragment class and in its xml layout i have added a toolbar with some text in it. But due to some reason app name is also displayed there. I have made other pages as well with the same code but the name is displayed only on this one.
Here is my xml code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.v7.widget.Toolbar
android:id="@+id/my_toolbar1"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
<TextView
android:text="Recharges"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Large"
android:textColor="#ffffff"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView1"
android:layout_weight="1" />
</android.support.v7.widget.Toolbar>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/logo"
android:id="@+id/imageView3" />
<GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnCount="2"
android:rowCount="5">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:layout_row="1"
android:layout_column="0"
app:srcCompat="@drawable/mobile"
android:id="@+id/imageView4" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_row="1"
android:gravity="center"
android:layout_column="1"
android:layout_marginTop="30dp"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
android:text="Mobile"/>
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="25dp"
android:layout_row="2"
android:layout_column="0"
app:srcCompat="@drawable/tv"
android:id="@+id/imageView" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_row="2"
android:layout_column="1"
android:layout_marginTop="30dp"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
android:text="DTH"/>
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="25dp"
android:layout_row="3"
android:layout_column="0"
app:srcCompat="@drawable/data"
android:id="@+id/imageView8" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_row="3"
android:layout_column="1"
android:layout_marginTop="30dp"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
android:text="DataCard"/>
/>
</GridLayout>
In your code --
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
Change above line to:
Then the title will be shown in white colour.
Replace toolbar code with this:
In Java: