8

This is my code in my android manifest file.

supports-screens android:resizeable="true"
              android:smallScreens="true"
              android:normalScreens="true"
              android:largeScreens="true"
              android:xlargeScreens="true"
              android:anyDensity="true"

What I understand from supportscreens is that it can be used to simply fit the app screen onto the multiple screen sizes done by resizing it and stretching the image. However, I don't see any difference with or without this code. Can anyone help me?

  • And it has the ''. I just deleted them so I can post the code without any error. –  Jul 04 '13 at 06:52
  • have you make layout folder in res folder??? – Shani Goriwal Jul 04 '13 at 07:01
  • no. what is that and how do i do that? –  Jul 04 '13 at 07:06
  • If you want to your application in different screen size of device then you have to make all screen size layout folder... – Shani Goriwal Jul 04 '13 at 07:07
  • so i need to create different layouts for the different screen sizes? That means if I want for all (small, normal, large, and xlarge) i need to make 4 folders? How do I do this? –  Jul 04 '13 at 07:10
  • FYI, I believe as of Android 3.2, these were replaced with just `android:requiresSmallestWidthDp`, `android:compatibleWidthLimitDp`, and `android:largestWidthLimitDp`: https://developer.android.com/guide/topics/manifest/supports-screens-element – Joshua Pinter Jun 29 '21 at 20:09

2 Answers2

10

Just Like this:

 /res/layout/layout.xml         // Default layout
 /res/layout-small/layout.xml   // Small screens
 /res/layout-large/layout.xml   // Large screens
 /res/layout-xlarge/layout.xml  // Ex

You can go even further and make also different layouts for portrait and landscape views by specyfing another keyword in directory's name:

 /res/layout-small-land/layout.xml      // Small screens, landscape view
 /res/layout-small-portrait/layout.xml  // Small screens, portrait view

Remember that tags order is important, so you can't write layout-portrait-small.

And in last add this code to your manifest file:

<supports-screens 
    android:resizeable="true"
    android:smallScreens="true" 
    android:largeScreens="true"
    android:xlargeScreens="true"  
    android:normalScreens="true" 
    android:anyDensity="true"/>
Manuel Allenspach
  • 12,002
  • 13
  • 52
  • 74
Shani Goriwal
  • 2,361
  • 1
  • 16
  • 31
  • Okay thanks man! So do I have to manually write any code in manifest other than the supports-screens, or does the program automatically decide which layout folder to use depending on the screen size of the device? –  Jul 04 '13 at 07:24
  • Yes.....after implenting this, you don't to do anything whenever you run application in any device accroding to that screen size that layout called... – Shani Goriwal Jul 04 '13 at 07:27
  • @ShaniGoriwal after creating those different folders do i need to add anything in those folders or simply make them empty? –  Dec 01 '14 at 11:46
  • `android:resizeable` is deprecated. – Onur Yıldırım Nov 18 '17 at 01:19
  • what about if we don't create 4 layout folder but add those lines to manifest. Would that be a problem? – Hilal Nov 19 '18 at 20:59
1

Please have a look at the Android Training site for "Designing for Multiple Screens"

AlexVogel
  • 10,531
  • 10
  • 61
  • 71