android - 如何在android studio中删除标签

标签 android kotlin

现在我正在尝试使用我创建的自定义工具栏,但是有一个白色标签。 text : test with white color

我怎样才能删除它?

下面是我的 list 和 styles.xml 代码

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.test">

<application
    android:allowBackup="true"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- No Title Bar-->
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

更新我的 toolbar.xml

<androidx.appcompat.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
app:theme="?attr/actionBarTheme">

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:contentDescription="resquare_logo"
    android:src="@drawable/logo"/>

最佳答案

在 Kotlin 中你可以这样做

 val toolbar = findViewById<androidx.appcompat.widget.Toolbar>(R.id.toolbar)
 setSupportActionBar(toolbar)
 supportActionBar?.setDisplayShowTitleEnabled(false)

关于android - 如何在android studio中删除标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58072002/

相关文章:

Android Studio 3.4 依赖项建议 - 使其不显示 alpha/beta 版本

android - 在绝对布局中设置图像位置

java - 从 onBalloonTap 加载 Activity

java - 如何创建json模型类?

android - 在项目中使用 ActionBarSherlock 的问题

kotlin - 创建 jvm 和 Kotlin 多平台的 Github 库组合

java - 如何在 Android Studio 中更改已弃用的代码

kotlin - 我是否需要在Kotlin中为val变量添加get()?

Kotlin,是否可以访问这对 map ?

android - 应用程序如何知道设备已经安装了该应用程序并将其从推荐奖金中消除?