Question

I am new to android programming , and I recently encounter a layout problem.

So far I know that the android allow layout file in hdpi, mdpi, lpdi , xxhpdi and so on...

The problem is all the files is only in larger scale , but what if I need to handle the different size 16:9 , 16: 10 , 4:3?

If the vertical size is not fixed, then I add a scroll view , but if it is not fixed at horizontal size? Is the UI design logic is the main content is fixed at the center, and there is a background image to cover the rest area, so that no matter 16:9 , 16: 10 , 4:3 the only different is a larger background image area?

Sorry for it is generally not a programming problem (but it may fixed through xml layout?) Thanks for helping

Was it helpful?

Solution

Stop thinking about a fixed list of screen aspect ratios and just make your layout so that it looks nice in any reasonable screen dimension. A good UI for pretty much any task should be able to stretch to fit any dimension nicely. If you use a lot of images, make them nine-patch where possible. Things that just can't be stretched non-uniformly can be scaled to fill or fit.

The different DPI options are there just so that you can provide higher-resolution images for higher-resolution screens, they're not meant to solve the screen dimension differences.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top