-1

Is it considered good practice to copy and paste layout files to all other layout folders in Eclipse to support multiple screens in Android?

John P.
  • 4,358
  • 4
  • 35
  • 47
rajeev kumar
  • 239
  • 1
  • 4
  • 11

5 Answers5

1

No, this practice will effectively accomplish nothing. The reason folders such as layout-large and layout-land exist is to provide the developer with the option to support various screen sizes, SDK levels, pixel densities and orientations separately.

Let's say we have a Nexus 10 tablet. There is clearly more screen real estate on the Nexus 10 when compared to the Nexus 4. Should an app try to take advantage of the extra space on the Nexus 10? Of course it should! This is accomplished by using these various folders. I would suggest reading up on UI practices such as master/detail flow. When you copy the same layout resource to these folders you are not actually accomplishing anything more than just leaving a single file in the default layout folder.

Good luck and happy coding!

John P.
  • 4,358
  • 4
  • 35
  • 47
0

No it is not, different layout folders are provided to support multiple screens and resolutions, if same xml file is put in all the folders then effectively same screen layout is set for all the resolutions.

By default android will pick up the layout xml from layout folder, so even if you will not put xml in multiple folders, multiple screens will be supported but with default layout xml.

To sum up.

1.It is not required to put same layout file in multiple folders to support, only putting in default layout will suffice.

2.To support multiple screen sizes, change the layout file in multiple folders accordingly and not use the default layout one.

AndroCoder
  • 1,669
  • 1
  • 11
  • 5
0

Copy and Paste an xml layout file to all other layout folders will not support for multiple screens.

You need to design layout for every screen size and you need use drawable folders for different size images. and also u need to use dimension for each and every layout.

You can also make responsive layout with the single xml layout. Best way to make responsive layout is to use combination of Linear Layout and Relative Layout and different values folder with dimens file.

W I Z A R D
  • 1,224
  • 3
  • 17
  • 44
0

no its not a good practice if you only copy and paste.

It is not a good practice to create different layout folders for layouts. Create your layout such that it works fine with all the screen sizes. To achieve this, play with the layout attributes. You only need to have different images for hdpi, mdpi and ldpi types. The rest will be managed by android OS.

source

more info here

Community
  • 1
  • 1
Fasiha
  • 488
  • 3
  • 11
0

If you want to Support multiple Screens for your application the you can use One layout folder and set dimentions in diffrent Values.

Like:

for Phone res -> values -> dimen.xml

for 7 inch Tablet res -> values-sw600dp -> dimen.xml

for 10 inch Tablet res -> values-sw720dp -> dimen.xml

set dimen according to Device.

AmmY
  • 1,821
  • 1
  • 20
  • 31