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

时间:2020-07-15 18:43:06

标签: java android xml libgdx

我正在尝试更改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项目不同。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:3)

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

相关问题