Search code examples
javaandroidlayoutsizeresolution

Layout for screen size 18.5x9


I want to create a layout.xml for Samsung galaxy S8. I tried to set it up with a Screen size of 18.5x9 .. but when I start the App it didn't fit.

I also tried to work with the resolution (2220x1080 / 2960x1080) but this didn't work too.

Any idea to set the screen size of one layout.xml to exactly the size of the phone (its also working for large/xlarge phones.. so why not for the s8)?


Solution

  • Samsung galaxy s8 resolution is 1440 x 2560 pixels. So, if you want to create layout for this, you need to maintain your values and drawables folders for xxxhdpi. you can create your dimen file for xxxhdpi layouts.

    For drawables :

    drawable-ldpi        //240x320
    drawable-mdpi        //320x480
    drawable-hdpi        //480x800
    drawable-xhdpi       //720x1280
    drawable-xxhdpi      //1080X1920
    drawable-xxxhdpi     //1440X2560
    

    For Values :

    values-ldpi\dimens.xml
    values-mdpi\dimens.xml
    values-hdpi\dimens.xml
    values-xhdpi\dimens.xml
    values-xxhdpi\dimens.xml
    values-xxxhdpi\dimens.xml