java - Android 应用始终在工具栏中显示应用名称

标签 java android android-layout

我想在我的应用程序工具栏中显示特定文本,但它也总是显示应用程序的名称。我怎样才能摆脱应用名称和 TextView 的文本?

<android.support.design.widget.AppBarLayout
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:theme="@style/AppTheme.AppBarOverlay"
    android:fitsSystemWindows="true" >

    <android.support.v7.widget.Toolbar
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minHeight="?attr/actionBarSize"
        app:popupTheme="@style/AppTheme.PopupOverlay"
        android:fitsSystemWindows="true" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="left"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="The title I want to show"
            android:layout_alignParentTop="true"
            android:layout_alignParentStart="true" />

    </android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>

最佳答案

在 AndroidManifest.xml 文件中为 Activity 声明添加标签。

    <activity
        ....
        android:label="Name of Your Screen"
        ....
    </activity>

关于java - Android 应用始终在工具栏中显示应用名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41320456/

相关文章:

java - 怎么把字体变大?

java - 如何在 Java 中正确设置大文件名的 HTTP Content-Disposition?

android - java.lang.NullPointerException : Attempt to invoke virtual method 'void android.widget.ImageView.setImageResource (int)' on a null object reference 异常

java - 如何为现有代码记录List接口(interface)方法

具有 Cloud SQL 或数据存储的 Android App Engine

android - Android 移动应用程序的默认 Google Analytics session 超时是多少?

android - 无法均匀缩放 9patch 图像

java - android studio 中无法实例化一个或多个类错误,因此设计未显示

android - 在滚动上隐藏/显示底部导航 View

java - Java 中与 Socket 一起使用时可序列化的外部类