简体   繁体   中英

Qt for android: change the application icon

我将如何更改针对 android 的 Qt 项目的图标,以便应用程序的启动器具有此图标?

You should create an Android manifest file and edit it in Qt Creator. Go to Projects > Build Android APK > Details

Now Select Create Templates to create the manifest file and to open it in editor :

在此处输入图片说明

As shown in the picture, you can set three versions of icons for your application with low, medium, and high DPI values, from left to right.

This new way of making an android manifest file is available since Qt 5.4 along Qt Creator 3.3. There used to be a Create AndroidManifest.xml button in Projects->Run->Deploy in previous versions.

Open Run settings of your project and select Create AndroidManifest.xml, then you'll be able to modify the manifest which should include stuff like the icon.

Refer to this: http://qt-project.org/doc/qtcreator-3.2/creator-deploying-android.html

Look at the this article about anatomy of a Qt 5 for Android application. You should attach to your project file AndroidManifest.xml , where you can define icon of application .

I'm going to update this a bit: Using the AndroidManifest.xml, you can add android:icon="@mipmap/ic_launcherx" and android:roundIcon="@mipmap/ic_launcherx_round" to <application ... .

You can generate the icons simply in the android studio and add them to your project's android folder (ie: /android/res/[mipmap-hdpi]/[ic_launcherx.png] )

So this adds an icon and a rounded icon to the application. The interesting part, however, is the name; leaving the name @mipmap/ic_launcher will cause a "Error: Duplicate resource" ... So don't forget to change it. After that, a normal build should succeed =)

It is even more simplified in the QT Creator 4.12:

In the latest Qt Creator one is able to click on projects > Build > "Create Templates"

在此处输入图片说明

After that you can edit the Manifest as @Nejat explained:

在此处输入图片说明

Cheers!

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