Libgdx android icon not being applied - java

I made a game and now I want to change the icon, so I replaced the icons on res/drawable (with the same file name). But when I run the game on my android phone it still installs with the default libgdx icon and not my own icon. Then I tried to change the icon names and also making changes in my manifest file.
<application
android:allowBackup="true"
android:icon="#drawable/loh_icon" //loh_icon.png is my icon name
android:label="#string/app_name"
android:theme="#style/GdxTheme" >
Still the same problem, how can my game still have the default libgdx icon? I deleted those icons and replaced them. I also invalidated my intellij caches and restarted.

If you look in your android/res folder, you'll see 5 different directories starting with drawable. The part after the dash is the screen density.
Inside each folder there is a file called ic_launcher.png with a size for each screen density. This is why by default, you'll find this in your manifest: #drawable/ic_launcher. You'll need to make different resolutions for different densities, and replace them.
You can use this online tool to automatically do it for you: Android Asset Studio.
Make your icon and click the download link. Open the ZIP file, and extract it to your res folder.
You can delete the drawable folders. Go into your manifest, and set your icon to: #mipmap/ic_launcher

In Android Studio just right click over android/res -> new/image asset, on dialog choose icon_laucher and the radiobox for image, there you can select whichever image you want. Android will make all different images for you

Some phones will cache app icons. This means that it might keep showing you the old app icon even after you change it.
Try restarting the phone. Alternatively, you can try changing the theme of the phone if it has such an option (e.g: MIUI)

Android API 26 introduced adaptive icons:
https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive
libGDX provides new files that handle this. Use the libGDX setup wizard to generate a blank project to see it. The files are stored in:
android/res/drawable-apydpi-v26
You can edit ic_launcher_foreground.xml and ic_launcher.xml to set it up for API 26+ devices.

Related

Multiple screen size support android mobile application

Currently I am developing a android mobile app using android studio (java). Since it should multiple screen size I make another layout file with respect to the screen size which i need(xxx-high density). But still it is not supporting. The buttons are moving out of the screen.
I have used Relative Layout as a parent layout for all of my activity.
please somebody help me to get out of this trouble.enter image description here
Just do as the folowing,
res -> layout -> New -> Layout Resource File
Dont forget to give the same file name, just specify the size.

How to force an app icon on Android O? (Prevent the launcher from adapting it)

This is my first question on StackOverflow, so please bear with me if I fail to articulate my question.
I am working on an Android app that targets Android O, and I want the launcher to NOT show the icon adapted i.e. remove the white background.
I tried to use adaptive icons and they work, but the problem is that they change the icon itself making it rouned, square, squircle and tear-shaped.
At first I thought it's out of my hands, but some other apps (facebook, whatsapp and snapchat for example) have their icons unchanged.
tl;dr: How can I force an icon to be used by the launcher on Android O?
The other apps you mention (Facebook, Whatsapp, and Snapchat) don't yet target Android O. Once they do, they'll also be forced to have an adaptive icon as well.
Just remove the targetSdkVersion property from your app level build.gradle file. It will work.

Layout icon auto generated activity

I am currently using android studio 2.3.3 with Kotlin and I dont know why these icon are automatically generated (you can see the picture below). Normally I have only one icon. The four icons are exactly the same when I click on it

How to assign a Photoshop designed button in android studio?

I have designed a main menu screen for my app, including the buttons and background and I want to know is it possible to link these buttons directly from background without putting each one of them in draw-able folder?
or do I have to put each one individually?
same as eclipse put png file in drawable folder and set ::
android:background="#drawable/imagename"
Copy and paste all the files into your drawable folder and then link them to your xml attributes using.
android:background="#drawable/filename"

ActionBar Icons having different sizes

In my android application, some of the action bar icons are at normal size (like the star in the screenshot) and some are too small (like the browser and the share icon in the screenshot).
All of the Icons are added in the exact same way:
menu.add(getString(R.string.sync)).setIcon(R.drawable.ic_action_sync)
This happens in three of my activities with different icons. The image files are in the correct directories for their density, they are all from the ActionBar Icon Pack and do all look the same size in the directory on the computer.
I use ActionBarSherlock to display the Actionbar on Gingerbread, but it looks exactly the same on ICS/JB, where ActionBarSherlock should use the native ActionBar (so I guess it's not ABSherlock's fault).
I have no idea, what the reason of this could be.
It looks like your icon drawable resources are not the correct size. To fix this, you will need to recreate your icons.
When you do this, be sure to check the Android Design- Iconography page to ensure that you are creating your resources at the right resolution.

Categories