Qt for android: change the application icon

妖精的绣舞 提交于 2019-12-12 09:34:45

问题


How would I change the icon of Qt project targeted for android so that the launcher of application has this icon?


回答1:


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.




回答2:


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




回答3:


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.




回答4:


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 =)



来源:https://stackoverflow.com/questions/26423150/qt-for-android-change-the-application-icon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!