现在我正在尝试使用我创建的自定义工具栏,但是有一个白色标签。 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/