Search code examples
androidsizecompatibilitydevice

android multiple screens compatibility


I read info about "Supporting Multiple Screens" and other post here... but Im really confused about how can I develop my application that run on multipple devices. I was starting develop on a determinate screen (normal size layout), then I run my apk on a S4 galaxy so I see that every object of my apk was diferent size to my xperia to the S4. what I need to do to make my apk compatibility for all the devices? I read information that the only source to make that is:

  1. res/layout/my_layout.xml // layout for normal screen size ("default")
  2. res/layout-small/my_layout.xml // layout for small screen size
  3. res/layout-large/my_layout.xml // layout for large screen size
  4. res/layout-xlarge/my_layout.xml // layout for extra large screen size
  5. res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation

    For:

  6. res/drawable-mdpi/my_icon.png // bitmap for medium density

  7. res/drawable-hdpi/my_icon.png // bitmap for high density

  8. res/drawable-xhdpi/my_icon.png // bitmap for extra high density

is this true? so I need to make different layouts for different devices? guys please help me with this issue cz I relly dont understand how is the deal for multiple devices compatibility.


Solution

  • Have you read this page? Or this one?

    You create resources with duplicate names located in folders that are qualified a certain way. At runtime, the system will choose the resources that best match the current configuration of the device. If you want your device to work on multiple screen sizes and multiple screen densities, you will need to create different resources (layouts, drawables, etc) and qualify them appropriately.