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.
Related
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.
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 working on an android app. as this should be all screen size supportive .but it is not working properly.
I can I set that for 480*800 size it will take images from drawable-hdpi folder?
Screen size and dpi aren't the same thing. DPI is the number of pixels per inch. a 480x800 screen can still be any dpi level- it would just be a smaller screen with higher dpi.
You can try doing a size override with drawable-swNdp where N is a pixel value. That works for layouts, I believe it also works for drawables.
To support on all resolution devices put different resolutions images in different folders in drawable as,
drawable-ldpi - 240 * 380
drawable-mdpi - 320 * 480
drawable-hdpi - 480 * 800
drawable-xhdpi - 720 * 960
For more info about resolution refer this link :
http://developer.android.com/guide/practices/screens_support.html
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.
I am developing an app which must support Samsung Galaxy Note - 2.
Now note-2's pixel resolution is 1,280 x 720. Reference Wikipedia.
While developing an app, I found that it was picking images from res/drawable-hdpi.
So for what resolution layout I should prepare the images ? Or do need to make separate resource folder ?
Resources are picked based on DPI a quick reference for what DPI each device uses can be found here:
http://blog.blundell-apps.com/list-of-android-devices-with-pixel-density-buckets/
For image scaling, the images should roughly be sized like so:
if an image is to use 100 dp then the actual images sizes will be:
ldpi: 75px
mdpi: 100px
hdpi: 150px
xhdpi: 200px
if you want to use 100 px on your NOTE 2 then the image sizes will be
ldpi: 50px
mdpi: 66.67px
hdpi: 100px
xhdpi: 133.33px
you can use the following site do do quick calculations:
http://labs.skinkers.com/content/android_dp_px_calculator/
Prepare images for hdpi resolution -- 480x800 hdpi.
Galaxy Note 2 is normal size, xhdpi density and long. You can prepare layout or drawable for xhdpi. For details, please check this post Galaxy Note 2 screen specifications. If you don't have xhdpi resource, android will try to find resource in hdpi.
The Galaxy Note uses hdpi which is a pixel density of 240dpi
Android Device Resolutions