简体   繁体   中英

How to change application icon for a libgdx android project

I'm trying to change the application icon for a libGDX Project, which I use to develop games. They give a sample ic_launcher.png file to use for setting the app icon, and I'm trying to change it to a different png file. I have specified everything for mdpi, hdpi, xhdpi, xxhdpi, and xxxhdpi, and also an anydpi, but in the AndroidManifest.xml , when I want to change the icon to @drawable/my_launcher , it says that it's an invalid symbol. I have even specified the same lengths and widths as the ic_launcher.png provided. Here is the AndroidManifest.xml file.

<?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>

This is a libGDX project, so it's different from normal Android Studio projects. Any help will be appreciated.

You shouldn't need to change any code. The android\res folder has folders with icons for different resolutions. You can simply overwrite the ic_launcher.png file in each of those folders with your own custom image (make sure you match the sizes of the existing images in each folder). That's how I've done it and it works great.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM