Android phones using wrong drawable folder - android

I currently have all the standard drawable folders set up for my app on 2.3.3. (ldpi hdpi mdpi xhdpi) However, whenever I run the app on a 240dpi screen (hdpi) it uses the resources found in drawable-mdpi not drawable-hdpi. When I delete the mdpi folder everything work perfectly. Testing on the other screen densities works great. Just not hdpi screens. Any suggestions?

I was missing some declarations in my manifest file. Adding these fixed my problem.
<uses-sdk android:minSdkVersion="4" />
AND
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true" />

240dpi screen take only ldpi drawable folder if there is no ldpi drawable it will autometically
get mdpi drawable....
the hdpi drawable means high density pixel(480dpi)

Related

Supporting multiple screen size

I've used several images with different sizes. I copied the images into different folders.
such as (except drawable-ldpi folder):
for example :
drawable-mdpi test.png => 60*60 px
drawable-hdpi test.png => 85*85 px
drawable-xhdpi test.png => 110*110 px
drawable-xxhdpi test.png => 110*110 px
I have only one folder my layouts:
my manifest:
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:resizeable="true"
android:smallScreens="true"
android:xlargeScreens="true" />
now, when I install my project on galaxy s4, images within the program shows drawable-mdpi folder. why ?
I even made ​​a separate folder for my layout and changed width and height of image :
res/layout/my_layout.xml imageview => layout_width and layout_height = 48*48 // default
res/layout-large/my_layout.xml
res/layout-xlarge/my_layout.xml
But always the default option is selected ! why?
you don't need to write support-screens in the minifest - default is fine.
first things first:
s4 is on the upper end of normal but it should still be normal not large. this is why your 'layout-large' was not used. but you should not use the size selection stuff, dpi selection is much better (so one layout should work).
s4 is on the edge between xxhdpi and xhdpi so samsung can decide what it is. i think they used xhdpi. but this should not realy matter.
dpi categories:
ldpi (you will not need it because neerly no device has it)
mdpi = 160dpi or 1x
hdpi = 240dpi or 1,5x
xhdpi = 320dpi or 2x
xxhdpi = 480dpi or 3x
simple dpi example:
if you have a fullscreen design/image in full hd (1080x1920) you can just cut the stuff out as you need it and will get it correct for xxhdpi. (if i remember correct - maybe xhdpi)
however, you can calculate the lower sizes from this point.
- xxhdpi = 1080x1920
- xhdpi = 720x1280 (/3*2 of the above)
- ...
if you do it this way it should work correct ;)

Multiple Screens Android

I'm developing an app in android and I have to support many different screen sizes and density. So i've created different a folder for layout : layout and layout-large.
For a normal screen size I have these drawable folders: mdpi(with a 320x480 image in it), hdpi (with a 480x800 image in it), and xhdpi (with a 640x960 image in it), but I also need a mdpi for a xlarge size screen. Should I create a drawable-large-mdpi and then put my image (480x800) in there?
Anyways I tried to do that and it seems to work just fine.
On my manifest I have:
<supports-screens android:resizeable="true"
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true"/>
I'm using three different emulators:
4.0" WVGA (480X800: hdpi),
3.2" HVGA slider (ADP1) (320x480:mdpi), and
5.1" WVGA (480X800: mdpi)
My problem is that when I run it the size of the screen never match in any of the emulators. The width seems to get a bit smaller. It is never 100%
In the AVD manager when you start your AVD manually you get Launch options, there put a check mark against scale display to real size.
Setup your monitors dpi by clicking on the question mark.
Enter the monitor screen size and monitors resolution and then click on ok.
Now enter the screen size for your emulator in inches and then click on launch.
Do the same for all three emulators your testing the app against.

how to handle android different device size

I know many persons have asked this question, but I really can't get a clear answer. I am new to android, and find it's hard to have my layout work well on all different size devices.Below is the problem:(I put the sprite image in drawable-hdpi folder).
On mdpi device with resolution 320*480,the screen looks like this:
on hdpi device with resolution 480*800, the screen looks like this:
both images above looks good, but when on mdpi device with resolution 480*800, the screen is looks bad like this:
Could you please tell me how to solve this problem? I can't understand why it's mdpi device when its resolution is 480*800?
You should always provide bitmap resources that are properly scaled to each of the generalized density buckets: low, medium, high and extra-high density. This helps you achieve good graphical quality and performance on all screen densities.
To generate these images, you should start with your raw resource in vector format and generate the images for each density using the following size scale:
xhdpi: 2.0
hdpi: 1.5
mdpi: 1.0 (baseline)
ldpi: 0.75
This means that if you generate a 200x200 image for xhdpi devices, you should generate the same resource in 150x150 for hdpi, 100x100 for mdpi, and 75x75 for ldpi devices.
refer this link :
http://developer.android.com/training/basics/supporting-devices/screens.html
and add this to your manifest
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:resizeable="true"
android:smallScreens="true" />

How to place images in Android drawables

Android Asus tablet is acessing images from android mdpi drawable and also lgoptimusp509 is accessing images from same mdpi folder.
Due to this I am facing alignment problems. How to fix this?
You should provide resources for multiple resolution and densities by following the guidelines at Supporting Multiple Screens.
There is also a tool from Google Android Asset Studio where you can upload your icons,menu icons,action bar icons and it will properly scale them for ldpi,mdpi,hdpi. You should also have a look at that.
You should provide resources for multiple resolution and densities.
so you have to put same images in hdpi,mdpi and ldpi drawable folder with diff resolutions.
and write this code in android manifest.xml
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:resizeable="true"
android:anyDensity="true"
/>
Devices access the images according to their density.so you should put same images in hdpi,mdpi and ldpi drawable folder with different resolution,so that those images will fit in respective devices.

mdpi and hdpi images are not correctly loaded into the device android

i have images accordingly int the hdpi and mdpi folder but when i run the application the hdpi images are loading fine on the high resolution devices but when i run on medium resolution 320 x 480 the hdpi images are loading not the medium ones. i have also tested moving the images to res/drawble but nothing happens.. please help me on this
i have set the manifest file with
<supports-screens android:smallScreens="false" android:normalScreens="true"
android:largeScreens="true" android:anyDensity="true">
<uses-sdk android:minSdkVersion="8" />
Please check if your drawable folders are correctly named.
They should be:
drawable-mdpi
drawable-hdpi
Also, be sure that your file names are identical. It works fine for me.
Sometimes it may even work to clean the project using Eclipse.
EDIT:
I think your project is working fine, but you're making some mistakes with your setup. You probably haven't read the developer guide properly: http://developer.android.com/guide/practices/screens_support.html
Anyway, what you're essentially doing is saying that mdpi = 320 x 480 and hdpi = 480 x 800 pixels. But that's not correct. The DPI (dots per inch) has nothing to do with the actual resolution of the screen. You can easily have a medium DPI screen with a resolution larger than 320 x 480 pixels.
Read the link that I posted - especially the part called "How to Test Your Application on Multiple Screens". That should help you.

Categories

Resources