tags:

views:

290

answers:

1

I've read the Android documentation: http://developer.android.com/guide/practices/screens_support.html but still have some questions.

I'm trying to design a music application which basically has images of the instrument (ImageButton) that play a sound when clicked. However, I'm confused about how to have the ImageButtons scale to fit all the different screen sizes and how to position them.

  1. Which layout is best used for needing to position ImageButtons in specific locations on the screen? (i.e. cymbals on a drum set) FrameLayout, RelativeLayout?

  2. If I only really care about medium and large screens, do I need to create different resources (images) for both as well as a different XML layout to position them?

I'm trying to find the simplest way to do this without having to create a separate layout XML file for positioning/size and separate image resources for each screen.

Any guidance is greatly appreciated. Thanks!

A: 

Which layout is best used for needing to position ImageButtons in specific locations on the screen? (i.e. cymbals on a drum set) FrameLayout, RelativeLayout?

RelativeLayout. In the real world, cymbals are positioned relative to the drums.

If I only really care about medium and large screens, do I need to create different resources (images) for both as well as a different XML layout to position them?

In terms of the layout, you only need a different layout if the rules would differ. It is very possible that the positions of the cymbals relative to the drums would not change based on screen size.

In terms of the images, I would suspect you'll want separate versions for different screen densities, not for different screen sizes. That way, a cymbal will be (roughly) the same physical size (inches/millimeters), even though that takes more pixels on a high-density screen. If you use the same images for all densities, in some cases, the images may be too small to tap readily.

CommonsWare
I'm confused regarding the densities. I see that with medium density, the screen resolution could be either 320x480, 480x800, or 480x854. So if I have a cymbal image thats 300px wide in the mdpi folder, how is it going to look the same size on all 3 different screen sizes?
droidy
And by look the same size, I mean scale to be bigger or smaller depending upon the screen size.
droidy