Dynamic Scalable Size Android

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.

Example

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 ║
╚════════════════╩════════════╩═══════════════╝

Example:

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.

Thanks.

Hardik D.

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.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store