Since the new versions of Android Studio (Starting at 4.2 I think), I haven't been able to import images correctly. Let me explain what I mean by 'correctly'.
Before, importing an image of a high resolution (usually xxxhdpi) would automatically be converted to different sizes for lower resolutions (down to ldpi). Nowadays, all Android Studio seems to want to do is convert images to some grey rectangle and say "here you go, use that".
Now I don't think this is the desired behaviour which makes me believe that there is possibly some configuration to change or update that I have missed.
Below is the image I would like to import (with its resolution) and what Android Studio shows me:
Original: 832x456 image in PNG format
Android Studio import:
Can someone either explain if I'm doing something wrong or if this is the actual behaviour now ?
If this is the behaviour, my only option is to write a simple python script to generate the correct resolution versions based on the Android guidelines but I'd like to avoid this if at all possible.
Related
I everybody i'm learning how to use android studio for the first time and i'm having problems with my images.
I used android studio design interface to position my imageviews on their correct positions and i also used it to resize them. The problem is that when i run it on emulator, even though i'm using the same "canvas" on the android studio design interface as the screen on the emulator, the images appear in different positions. And if i try different emulators with different screen sizes they can go even more wild and change their positions intarelly.
I made some research and most of the people say that android studio needs different images and create different drawable folders for each screen type.
I've done that and it almost fixed my problem but some of the images still change their position a bit. I suspect that my problem is that i resize the images with android design tool, but i'm not sure.
Can someone theorize why this is happening? (if it is about using the design interface to change the images width and height that is creating my problem)
What is the best way (practices, methods, tools,...) to put images without them changing their positions in different screens?
Shall i change the images sizes on photoshops for example instead of on android studio?
P.S: I know it's too much to read but i would appreciate any help.
I know it's not a vital problem, but it occupies my mind. As you can see in the image, Android Studio shows a nice preview of some images in the editor's sidebar.
There are 3 PNG images with the same format and same dimensions. But Android Studio only shows the preview for just two of them.
I'm using Android Studio 2.0 Beta 2 .
Does anyone knows the reason behind or is there any special property for the images to be able to be previewed by Android Studio?
I'll appreciate any answer.
I've recently published an app in the Android Market. My APK contains icons for res/drawable-hdpi, drawable-ldpi and drawable-mdpi. The icon files are perfectly valid - saved by Adobe Illustrator and show without problems in all browsers, Photoshop, Paint and Paint.NET. Icons are grayscale, but stored in 32Bit PNG.
For some reason, Android Market on phones and Developer Console show a garbled version of the same icon. It looks like my nice gradients are reduced to dotted, black and white mess.
Now, I suspected pngcrush / some similar APK optimisations, but the optimised, 8-bit PNG in the final APK are still perfectly renderable in all browsers etc. Also, the menu on the phone renders it without problems.
Any help appreciated.
ANSWERED:The cause appears to be in the scaling algorithm used by Android Market backend. I've resolved the issue by replacing pure black surfaces RGB(0,0,0) with almost-entirely-black RGB(1,1,1) and the problem's gone away.
The cause appears to be in the scaling algorithm used by Android Market backend. I've resolved the issue by replacing pure black surfaces RGB(0,0,0) with almost-entirely-black RGB(1,1,1) and the problem's gone away.
I'm looking for a system-wide graphic that (I think) is in android.R.drawable. I am looking for this one:
I realize that graphics differ between systems, however I am fairy sure that it is system wide because I have seen it in multiple programs.
I want to use the one Android provides so that my app looks good no matter what phone it runs on. Does anyone know where I can find that image to use in my program?
Taking a look at Android R Drawables, it seems it might be expander_ic_minimized.9
You can find those images in the Android SDK directory under
platforms/android-X/data/res/drawable-Ydpi
where X is the version code of Android and Y is the resolution (l/m/h). Most images are in the mdpi folder.
It is recommended to copy the images to your App, as the Android developers do not guarantee that all images will be there in future releases.
The image you are looking for looks like
expander_ic_minimized.9.png
TOPIC Solved: Answer below.
Some users have been reporting border alignment issues on some android components such as the alert popup or the editTexts. This is happening on the Samsung Galaxy Apollo (200x400) and the HTC Pro Touch (480x640) devices. I cannot replicate that because i don't own those devices and in the Samsung Galaxy S and emulator everything looks just right.
I think that the problem is the dpi or resolution of the device (because the edittext background is a single .9.png so image should look ok); however I am not sure if the supports-screens tag is the solution. Also, application was developed using Api 3 (v1.5) and supports-screens was not yet supported, nor the screen-size resource qualifier.
The style used for the alerts and editText is the phone default. Could the problem be something related with the theme applied to the phone by the user?
Thanks in advance!, I show some images given to me showing the problem:
It might actually be the display density causing this. If you don't provide assets in the appropriate density, the framework will try to rescale your images, including 9patches. Unfortunately there's no real perfect way of resizing 9patches and it can sometimes lead to artifacts, although I would be very surprised if it caused the type of artifact you are seeing.
I've had the same problem and the solution was changing the font size of the TextView from 16px to 17px (or any other odd number).
Well it really was the resolution/density. I managed to create an emulator with the WQVGA density (which needed > Android 1.6) and replicate the error.
The solution is seen on the Supporting Legacy Applications section of the Android Developers webpage: http://developer.android.com/guide/practices/screens_support.html. So a newer version of the API is needed in the project but it still holds support for the 1.5 version.
Thanks.