For example, I'd like to show an image in screen. Here are the size and dpi:
LDPI - 0.75x 75x75 120 dpi
MDPI - Original size 100x100 160 dpi
HDPI - 1.5x 150x150 240 dpi
XHDPI - 2.0x 200x200 320 dpi
XXHDPI - 3x 300x300 480 dpi
XXXHDPI - 4.0x 400x400 640 dpi
But the display for two devices is not what I want.
The first device is 480x800, 240 dpi. The second device is 800x1280, 213 dpi.The bigger screen has lower dpi. I need some advices on how to handle this case? Thanks
What I see is that your first device is a mobile while the second is a tablet. So you can provide alternate layout files for mobile's and tablets. See supporting multiple screens for more information. For this case for mobile you can use layout-sw720dp folder and for the bigger tablet screen. As for the images your current settings above will work great.
Related
I have a app which i developed for 10.1 inch tab which has resolution 1280x800 and having Density 160ppi,so when i am running the same app on a 7inch tab with has resolution of 800X1280 and having density 214ppi in that the UI of the app is looking kinda weird they are looking bigger as compare to 10inch tab. so what step should i follow to resolve this issue.Note: The Images that i am using in my App is initially designed 1280X800 and 160ppi density.
1280 x 800 160ppi is MDPI devices
800 x 1280 214PPi us TVDPI devices
//you need to supply different density Images like
MDPI and HDPI images
TVDPI devices will pick from HDPI image and auto scale them
//you can also supply different drawable for large and xlarge drawables.
I am having this issue where I have HDPI and XHDPI folders in my eclipse project both have different images resolutions, both Images in the different folders are exactly the same but they differ in size.
So I lunched my app on Samsung Galaxy Note 1 which have 800 x 1280 pixels, 5.3 inches (~285 ppi pixel density) display, but it's loading drawables from the XHDPI folder.
I have tested that by modifying one image in HDPI folder and keep it as it is in the XHDPI folder, the result was note 1 is loading from the XHDPI folder, am I missing something here, it suppose to load images from the HDPI folder because it's screen density is smaller than 320 DPI.
You can check what density your device is set to with
Log.v(TAG, "density=" + getResources().getDisplayMetrics().densityDpi);
am I missing something here, it suppose to load images from the HDPI folder because it's screen density is smaller than 320 DPI
The maker of the device chooses which density bucket to use. Since ~285 is closer to 320 than 240, it is not surprising to me that Samsung chose -xhdpi. Others have reported that it indeed is an -xhdpi device.
If you are finding that -xhdpi resources result in slightly too large of images in certain places, you may need to control that in those places (e.g., set the ImageView size to the size that you want and set android:scaleType to be how you want the image to be adjusted).
it suppose to load images from the HDPI folder because it's screen density is smaller than 320 DPI.
why that?
HDPI is 240 ppi
XHDPI is 320 ppi
Note 1 has a 285 which is closer to XHDPI (|285-320|=35) than to HDPI (|285-240|=45)
On Android developer website, it says,
"hdpi Resources for high-density (hdpi) screens (~240dpi).
xhdpi Resources for extra high-density (xhdpi) screens (~320dpi)."
Any device which has a density higher than 240dpi should load layouts and images from xhdpi folder.
Thus, your app on galaxy note which has 285dpi loads images from xhdpi folder.
Which resource identifier can I use for Google TVs to distinguish it from phones like the Galaxy S3, layout-sw720dp doesn't work?
You can use tvdpi:
Resources for screens somewhere between mdpi and hdpi; approximately
213dpi. This is not considered a "primary" density group. It is mostly
intended for televisions and most apps shouldn't need it—providing
mdpi and hdpi resources is sufficient for most apps and the system
will scale them as appropriate. If you find it necessary to provide
tvdpi resources, you should size them at a factor of 1.33*mdpi. For
example, a 100px x 100px image for mdpi screens should be 133px x
133px for tvdpi.
TV setting Addressable screen size (in pixels) Density identifier screen density (in dp) Display resolution (in dp) Screen size identifier
720p 1280 x 720 px tvdpi 213 960 x 540 large
1080p 1920 x 1080 px xhdpi 320 960 x 540 large
This is from: https://developers.google.com/tv/android/docs/gtv_android_patterns
More detailed info on display guideline: https://developers.google.com/tv/android/docs/gtv_displayguide
I tried the tvdpi, but unfortunately the Galaxy S3 was picking up its resources. I ended up using layout and layout-large for the resources. The Nexus and Google TVs get their resources from layout-large and the Galaxy S3 gets its resources from layout. Thanks.
I have two android devices with the same screen resolutions (800x480) and dimensions.
The difference is that one screen is low density (120 dpi) and the other normal density (160 dpi).
I don't understand the reason by the same image of 200x200pixels is smaller in the screen with less density and if i write a rectangle of 200x200 pixels is the same on both screens.
Can anybody explain me the reason?
Thanks in advance
A 90 pixel image at ldpi becomes a 120 px a mdpi, a 180 at hdpi and a 240 ad xhdpi.
You can find more informations about it here (search "Screen pixel density") : Dev Android Ressources
Another good link about Density : Screen Support - Density
I've develop an app for android and now I support large screen devices. So I create an image for this device. Now I want to resize large images for medium screen sizes.
What is the proportion? For example if an image for large screen is 85x111(px), what is the dimension for medium?
There are different screen densities. ldpi, mdpi, hdpi, xhdpi , you have to create different images for all these densities, if you would like to support all screen.
see the links below.
http://developer.android.com/guide/practices/screens_support.html
http://developer.android.com/resources/dashboard/screens.html
hdpi ~ 240dpi - 240 pixels per inch.
mdpi ~ 160dpi - 160 pixels per inch.
so the scaling factor is 160/240 = 2/3. so if you have 85 x 111 in hdpi, for mdpi it should be 85*2/3 x 111*2/3.