Dynamic Scalable Size Android

Hardik Dungrani
Dec 26, 2019 · 2 min read

DynamicSizes — dynamic scalable size unit

An android SDK that provides a new size unit — hsdp. This size unit scales with the screen size. It can help Android developers with supporting multiple screens.

With this library, you can support almost 97% of screens

Use it carefully! for example, in most cases you still need to design a different layout for tablets.


Here is a single layout built using hsdp:

Layout using hsdp

Here is a single layout built using dp:

Layout using dp

You can see that hsdp scales with the screen size and the dp stays with the same size on all screen sizes.

How to integrate Dynamic Scalable Size Library into Android Project?

For use this library, you should use AndroidX instead of Support

Step 1:

Add below code into <project>/build.gradle file.

allprojects {
repositories {
maven { url 'https://jitpack.io' }

Step 2:

Add below code into <project>/<app>/build.gradle.

dependencies {
implementation 'com.hardik.hsdp:scalablesize-android:1.0.1'

How to Use Dynamic Scalable Size in layout?

║ Types ║ Values ║ Example ║
║ Normal sizes ║ hsdp ║ _15hsdp ║
║ Font size ║ font_ssp ║ _15font_ssp ║
║ Negative sizes ║ mines_hsdp ║ _minus15hsdp ║


How to use this hsdp size unit, please see this link : hsdp_layout.xml

So that’s all for this Dynamic Scalable Size Android Tutorial. If any query/suggestion for Dynamic Scalable Size Tutorial ask freely on hardikdungrani8@gmail.com

Please go through my GitHub repository.


Hardik D.

Hardik Dungrani

Written by

I have extensive experience in developing innovative and complex Android /iOS Apps and also in Website Developing. Been working in Kotlin for the last 2 years.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade