As a developer its really a big task to create a single GUI which runs as the same in all Android devices. This is because Android runs on various devices which has different screen size and resolution. Since there are huge number of hardware manufactures right from China mobiles to HTC uses Android OS they make there own screen size with affordable pixels. Depending upon the price of the device, the hardware ingredients varies.
First of all it is not at all possible to use a single xml file to fit all devices perfectly. A mobile device which is of 3″ inches width can no way scale up to match the screen size of tablet pc which is of 8″. So to support multi screen you have to write separate xml file for each screen.
Short term solutions:
- Using scaling attributes like px can be avoided and dp be used.
- Using higher resolution images for larger screens and lower resolution images for smaller screens. Higher resolution images must be grouped under project->resources->drawable-hdpi similarly drawable-ldpi for lower resolution images.
- The above mentioned point can be neglected if you go for images which is of .9.png formate.
- Relative layout can be used, attributes like parentBottom , parentTop will help you to place the Views with in the screen.
these are the temporary solutions. If you want to have a permanent fix there is no other way then creating separate xmls for each screen. Thank you for reading, will get back to this problem if I have any other alternative. Cheers.