Reputation: 65
Is it possible to make a layout for this nexus 4 resolution . my app give problem with custom views. i have layout-hdpi layout-xhdpi layout-xxhdpi
i know xhdpi includes 768 x 1280 and 720 x 1280 .
Upvotes: 0
Views: 3345
Reputation: 5420
dpi only partially depends on resolution. It is a measure of how tightly the pixels are packed on the screen. Thus, it is a function of both resolution, as well as the physical size of the screen.
Saying 768 x 1280 px = xhdpi may be correct for some devices, but incorrect for others. For example, what if you have a 10 inch screen that has that resolution? That would most likely be ldpi.
In order to support multiple screens, please follow this guide: http://developer.android.com/guide/practices/screens_support.html
You may want to use dp's instead of pixels in your layouts for setting widths and heights. You can then customize layouts based on the current width of the device by using layout directories such as layout-sw320dp ("smallest width 320 dp").
Upvotes: 1