I know this question have been asked several times, but, I am facing a unique problem, solution of which I have not been able to find.
I have images in drawable, drawable-ldpi, drawable-mdpi, drawable-hdpi, drawable-xhdpi and drawable-xxhdpi in ratio of .75:1:1.5:2:3 respectively.
For most of the emulators, images are appearing perfectly well, but, for some of them, images are not appearing in proper proportion.
Like images appears well in 3.2" HVGA slider(ADPI) emulator- 320x480 mdpi, but, images do not appear well in 5.1" WVGA emulator- 480x800 mdpi. This is despite the fact that both are mdpi.
Why is it that despite both of them being mdpi, images appears well in one and do not appear in proper proportion in the other? How can I overcome this.
Edit:
Image where it shows mdpi:
3.2" HVGA slider(ADPI) emulator- 320x480 mdpi and 5.1" WVGA emulator- 480x800 mdpi.
EDIT2:
I think I had a similar issue where the dp wasn't being scaled well for monitor resolution. In the device settings under 'startup size and orientation', switch the scale to something like 4dp on device = 1px on screen.
In Android Virtual Device Manager:
Related
I developed an android app that is designated to multi screens.
I have my background images in all kind of sizes. divided into sub-folders for hdpi mhdpi xhdpi and xxhdpi.
On my Galaxy S4 the pictures look great, but when i installed the app on a tablet of 8 inch screen with low density the pictures looked really stretched.
Am i doing something wrong?
just pot diffrent images in XDPI MDPI AND LDPI with same name
then Chek which one is getting detected in perticular device
then you knw it.
You are also creating a layout for each screen size? maybe the imageview is changing the size with each screen size.
I have both hdpi and xhdpi folders in my res folder. However, android makes use of hdpi xml file for 1280 X 800 resolution of a tablet. Could it be because my xml file accesses resources which are in drawable-hdpi folder but not in drawable-xhdpi folder?
I think you are confused with DPI vs screen sizes, which resolution along does not provide. You can have a XHDPI device with a small screen that is very high resolution (such as the Galaxy S3) or a MDPI or LDPI device with a very large screen (such as when you use Android on your TV).
Generally speaking, Dot per pixel = Resolution / Screen size.
Not all android devices are set to the right density by the manufacturer, its really a hodgepodge of densities no matter what resolution you think you have, the device could still be seen by the android OS as a lower or different density than you think
if the android OS thinks your device is HDPI then it will access HDPI drawables
According to this SO thread, on "normal" phone screens I should use a 320x480 background image for mdpi, 480x800 for hdpi and 640x960 for xhdpi.
However I am having some troubles to get the scale of my images right on the Galaxy S3, Galaxy Note and Galaxy Nexus, all of which have a resolution of 800x1280 (720x1280 in the S3 and Nexus cases). Most of the time my 640px wide background will get stretched to 720 or 800, but other images won't (as I explained in this other SO thread).
One solution seemed to work: instead of using 640x960 images on the xhdpi folder use 800x1280, as that is the exact resolution of those devices, so pretty much no re-sizing is needed.
However this breaks the 4:6:8 ratio recommended by the Android Developer Guide to be maintained between the mdpi, hdpi, xhdpi.
My question: would it be OK to use my solution? Has anyone else tried this?
I can't figure out how to produce drawables for the new "high-res" handhelds like the Galaxy Nexus, One X, Galaxy S3 etc that have a resolution of 1280x720 or higher.
I always try to make as few layout-versions as possible. Preferably just one but at times a layout-long and notlong is necessary. And make the xml smart enough to handle all devices. But that's only possible if the drawable resources are there to supply all the different resolutions and sizes.
All has been nice and smooth until the new big phones arrived and I find that the drawables are to small for them. No xxhdpi-folder yet from Google so I must be doing something wrong.
I know it's forbidden to mention pixels here but still you have to use photoshop or some other pixel based application to make the drawables. Therefore you need to know how big to make these drawables.
This is what i've done so far:
xhdpi: 640x960
hdpi: 480x640
mdpi: 320x480
ldpi: 240x320
The problem is that when a 1280x720 device gets the drawables from the xhdpi folder things starts looking bad, the images are too small and there's too much space between them.
What do you base your drawable source files on? xhdpi in 1028x720? That messes up the lower res versions for me.
I have an ad agency breathing down my neck wondering why it doesn't look as perfect as on the iPhone...
Well, as I said above I can't find any handhelds with Android on it that's got a resolution of 640x960. So I based all my images on 720x1280 instead and put the 640x960 resolution stuff in a large-hdpi folder.
Now my app looks great on the latest Nexus, the Galaxy S3, HTC One-X and all of the other newer hires models. I think the tablets when looking for resources will go for large first, then hdpi where they will find the 2x scaled images.
This is what I ended up with:
xhdpi: 720x1280
large-hdpi: 640x960
hdpi: 480x640
mdpi: 320x480
ldpi: 240x320
I have a Galaxy Nexus, and I use the xhdpi resource folder (at a 2.0 scaling factor) and the images look great. Do you have an example (screenshot preferably) of what issue you're having? If you're hardcoding spacing and sizes in pixels, then yeah, it'll probably look weird at higher densities. Are you trying to hardcode a background image 1:1 at a specific pixel size? If so, that's never a good idea on Android.
I'm developing an application which supports xhdpi devices.
so I created layout-xhdpi and drawable-xhdpi folders to place my drawables
and layouts.but I'm having a problem when supporting different resolution in same density.
as an example samsung galaxy nexus and sharp IS003 detects same layout-xhdpi folder because it has same density but when I run the application in both devices,it displays buttons and
images at different positions because both devices got different resolutions.
am I doing something wrong? should I create different folders for specific resolutions?
I have read supporting multiple screens documentation and tried to declare layouts like res/layout-sw600dp/ but it wont detect for IS03.
Please help me to solve this problem.
why you kept drawable-xhdpi?. there is no android tablet with xhdpi.
check here:
all the 10 inch tablet is only mdpi.
if you check your device density it will show only 160dpi for tablet.
there is xhdpi device for normal phone nexus S ICS.
so move all your drawable-xhdpi to drawable-mdpi and check it will work.