please check the image that shows the displayed output Я создал класс фрагмента и в его макете xml я добавил панель инструментов с некоторым текстом в ней. Но по какой-то причине имя приложения также отображается там. Я также сделал другие страницы с тем же кодом, но имя отображается только на этом.Почему отображается имя приложения на панели инструментов?
Вот мой XML-код:
<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>
Вы добавили андроида: тема = "@ стиль/ThemeOverlay.AppCompat.ActionBar" эту тему в других страницах также? –
Да, эта проблема изначально не была там, она появилась после кода схемы сетки. –
попробуйте использовать toolbar.setTitle («Recharges»); в вашем java-коде. Нет необходимости использовать дополнительный TextView для этого. –