Ankit Verma
Ankit Verma

Reputation: 728

How to support multiple screen sizes in android

I am having a problem displaying my layout in 5" or smaller screens .The smaller height of phone spills bottom views out display . I tried creating layouts using sw320dp and different dimens folder but app seems to take that smallest layout only for all type of sizes. I am unable to map the layouts properly . All I need is to make the size of views smaller in small screens.

Upvotes: 0

Views: 235

Answers (4)

MohsiinShah
MohsiinShah

Reputation: 1

You can use constraint layout, it will effectively adjust most of your views. Along with that, as a precaution, add scrollview in layouts where you think you have too many views just so they don't go out of screen bounds on smaller screen sizes.

Constraint layout doc: https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayout

Upvotes: 0

Hasan
Hasan

Reputation: 520

Try this library it will be helpful

implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation 'com.intuit.ssp:ssp-android:1.0.6'

This library will help to create flexible view items as per device screen sizes.

Upvotes: 0

user14253444
user14253444

Reputation: 75

Add this code in your Android Manifest xml

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

Upvotes: 0

Deepak
Deepak

Reputation: 11

-You should use ConstraintLayout for Create a flexible layout -You should use Different dpi icon for different phones like mdpi,hdpi,xhdpi,xxhdpi,xxxhdpi -you can also take reference from Google's Documentation https://developer.android.com/training/multiscreen/screensizes

Upvotes: 1

Related Questions