用关闭图标替换 OSS 许可证 Gradle 插件的主页指示器

问题描述

我将 com.google.android.gms.oss-licenses-pluginGoogleplay-services-oss-licenses 库一起使用。我的主题不包含操作栏,因此我使用操作栏 Theme.With.ActionBar 定义了另一个主题

一切正常。我只是无法将操作栏的后退图标 替换为关闭图标 ,尽管我尝试将其设置为 [android:]homeAsUpIndicator[android:]collapseIcon主题 Theme.With.ActionBar 和引用的 actionBarTheme 样式属性

我怎样才能做到这一点?

<activity
    android:name="com.google.android.gms.oss.licenses.OssLicensesMenuActivity"
    android:exported="false"
    android:label="@string/oss_license_title"
    android:theme="@style/Theme.With.ActionBar">
    <intent-filter>
        <action android:name="ACTION_LICENSES" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</activity>
<style name="Theme.With.ActionBar" parent="Theme.WithOut.ActionBar">
    <item name="actionBarWidgetTheme">@null</item>
    <item name="actionBarTheme">@style/ThemeOverlay.MaterialComponents.Dark.ActionBar</item>
    <item name="listChoiceBackgroundindicator">@drawable/abc_list_selector_holo_dark</item>
    <item name="windowActionBar">true</item>
    <item name="windowActionModeOverlay">false</item>
    <item name="windowNoTitle">false</item>
</style>

这个问题也可能与其他库有关。我的设备运行的是 Android 10。

解决方法

只需将此行添加到您的styles.xml

    <item name="navigationIcon">@drawable/ic_back_arrow</item>

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...