Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>How I would go about this, is having a static amount of images in each "row" which indeed are Horizontal LinearLayouts nested inside a Vertical LinearLayout (which maybe is nested inside a ScrollView?). </p> <p>Say you choose to have 4 images/line, you're concerned that on different screen sizes they would have too much or too little padding and the outcome would not look nice? Since you are new to programming I'll introduce you to one of the things you probably are not familiar with in Android.</p> <p>Your Project -> Res folder has a layout folder which contains the activity_main.xml</p> <p>Create new folders inside the res folder called:<br> layout-sw320dp<br> layout-sw320dp-mdpi<br> layout-sw320dp-hdpi<br> layout-sw320dp-xhdpi<br> layout-sw480dp<br> layout-sw600dp<br> layout-sw600dp-mdpi<br> layout-sw720dp<br> layout-sw800dp </p> <p>The folders above are just examples of what folders you can create. For example the layout-sw600dp-mdpi contains the layout files for a phone that's screen's "smallest width is 600dp and has a medium dpi." Smallest width means either the vertical or horizontal width, which-ever happens to be smaller.</p> <p>Lets say the phone you are using would natively use the "layout-sw720dp" folder for its layout but you dont have the folder in your project. Then the layout-folder the phone would use in this case is the layout-sw600dp-mdpi. The application will always use the "best/closest" layout the application supports.</p> <p>So first step is to choose which layout folders you want to provide. And the second step is to copy/paste your layout files from the default layout-folder to all of the other layout-folders. After this you can start setting different Sizes and Paddings/Margins for your Components, be they Images or Layouts or whatever.</p> <p>Always remember to set your Values in 'dp' instead of 'px' and font sizes in 'sp'.</p> <p>I hope I could be of help.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload