如何更改 libgdx android 项目的应用程序图标

How to change application icon for a libgdx android project

我正在尝试更改我用来开发游戏的 libGDX 项目的应用程序图标。他们提供了一个示例 ic_launcher.png 文件用于设置应用程序图标,我正在尝试将其更改为不同的 png 文件。我已经指定了 mdpi、hdpi、xhdpi、xxhdpi 和 xxxhdpi 的所有内容,还有一个 anydpi,但是在 AndroidManifest.xml 中,当我想将图标更改为 @drawable/my_launcher 时,它说这是一个无效的象征。我什至指定了与 ic_launcher.png 提供的相同的长度和宽度。这是 AndroidManifest.xml 文件。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="org.zunkuftedu.zunkuftlife" >

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:isGame="true"
        android:appCategory="game"
        android:label="@string/app_name"
        android:theme="@style/GdxTheme" >
        <activity
            android:name="org.zunkuftedu.zunkuftlife.AndroidLauncher"
            android:label="@string/app_name" 
            android:screenOrientation="landscape"
            android:configChanges="keyboard|keyboardHidden|navigation|orientation|screenSize|screenLayout">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

这是一个 libGDX 项目,因此它不同于普通的 Android Studio 项目。任何帮助将不胜感激。

您应该不需要更改任何代码。 android\res 文件夹中的文件夹带有不同分辨率的图标。您可以简单地用您自己的自定义图像覆盖每个文件夹中的 ic_launcher.png 文件(确保您匹配每个文件夹中现有图像的大小)。我就是这样做的,效果很好。