please check the image that shows the displayed output Ich habe eine Fragmentklasse erstellt und in ihrem XML-Layout habe ich eine Symbolleiste mit etwas Text hinzugefügt. Aber aus irgendeinem Grund wird dort auch der Name der App angezeigt. Ich habe auch andere Seiten mit demselben Code gemacht, aber der Name wird nur auf diesem angezeigt.Warum wird der App-Name in der Toolbar angezeigt?
Hier ist mein 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>
Sie android hinzugefügt haben: theme = "@ style/ThemeOverlay.AppCompat.ActionBar" dieses Thema auf anderen Seiten auch? –
ja dieses Problem war ursprünglich nicht da, es kam nach dem Grid-Layout-Code. –
versuchen Sie, toolbar.setTitle ("Lädt") zu verwenden; in deinem Java-Code. Es ist nicht nötig extra TextView zu benutzen. –