How to define dimens.xml for every different screen size in android?

后端 未结 9 2014
轮回少年
轮回少年 2020-11-22 00:43

When supporting different screen sizes (densities) in Android often the focus is on creating different layouts for every possible screen. I.E.

9条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-22 01:21

    There are nice libraries which will handle everything and reduce your pain. For using it, just add two dependencies in gradle:

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

    After that, use dimens like this:

            android:layout_marginTop="@dimen/_80sdp"
    

提交回复
热议问题