1

Actually i had develop my app for nexus S device..now i want to know that how can i maintain my app to develop in such a way that in any android device when it runs it fits into its actual screen size and resolution..i mean to say that now my app is working fine in nexus s device but when i run my app in another device with small size screen and resolution my whole layout changes..so can anyone please suggest me how can i maintain my layout in such a way that it run in any of the devices perfectly..

if possible please explain me with example..

regards

AndroidDev
  • 4,521
  • 24
  • 78
  • 126

1 Answers1

0

Check this tutorial: http://developer.android.com/guide/practices/screens_support.html

P.S: Please search on stackoverflow.com before posting a question. This has already been answered several times, latest here : Different Layouts For Different Screen Sizes On Android?

Community
  • 1
  • 1
sparkymat
  • 9,938
  • 3
  • 30
  • 48
  • yeh i have go through the document but there they say that for supporting multiple screen i have to create different layout for all screen such form small i have to create small layout and so on..similarly for image i have to use different drawable directory..but i dont understand how to do that..suppose i am creating a big application having 10 xml file than i have to create 40 xml file 10 for small layout,10 for medium,10 for large,and 10 for extra large..so i am true what i say.. – AndroidDev Jun 27 '11 at 09:54
  • Not necessarily. That is only the worst case. In many cases, using Layouts wisely, would help you have the same Layout for multiple sizes. In the visual editor, there is a drop-down which shows how the layout looks on a particular sized screen. Do read more about LinearLayout and RelativeLayout. – sparkymat Jun 27 '11 at 09:56
  • hi spark i have go through what you said..here they say that instead of crating alternative layout we can warp_content,Fill_content,or dp while given layout width or height..so if i develop my app for largeScreen where i maintain all my layout using wrap_conten,Fill_content,dp as appropriate..instead of using pixel than is it work fine in all devices with small screen or large screen.. – AndroidDev Jun 27 '11 at 10:29
  • Yes, if you correctly use wrap_content, fill_parent, "dp" (instead of "px"), then your layout will work for most screens. You can always test them out using the visual editor and the emulator. – sparkymat Jun 27 '11 at 10:37
  • ok that means in that there is no need to use alternate layout for different screen sizes..but for drawable we used different icon or images for for different devices..am i right or not – AndroidDev Jun 27 '11 at 10:42
  • That's correct. You can put the various images in drawable-hdpi, drawable-mdpi and drawable-ldpi. Note that this is not for various sizes, but for various pixel densities. – sparkymat Jun 27 '11 at 11:35