Q:

How to separate layouts for screens smaller and larger than 400dp?

In my XML layout directory I have a resource file defining view which contains some images. In a standard (simply layout) directory there are four images in a row:
[ image ] [ image ] [ image ] [ image ]
In case of larger screens the number of images increases. In case of smaller screens I noticed, that the last picture wasn't fitting and was covered by right border. So, decided to create layout-w300dp for smaller devices, and it displays the following view:
[ image ] [ image ] [ image ]
The problem is, that this view (3 pictures) is now applied also to screens  on which I had 4 pictures previously.
Is there any way to make the layout display 4 pictures when gets values from layout directory and 3 pictures for smaller screens (< 400dp)?

A:

Sure, your default layout should be for three pictures and your 4 picture layout for 400dp screens and greater should be defined in layout-sw400dp.
Edit additional info and link to docs
Android selects the appropriate resource by first looking at the default resource and then looking for something more specific. It considers larger screen-sizes and higher apis to be more specific than smaller and lower ones (as long as they aren't higher and bigger than the device the app is being run on). Thus you should make your default layout for the smallest screen and oldeest api you support. If you want the appearance to change for a specific screensize/api and higher then you add a resource for that api/screensize.
Relevant Dev docs: https://developer.android.com/guide/practices/screens_support.html

