Skip to content

Latest commit

 

History

History
53 lines (41 loc) · 2.31 KB

README.md

File metadata and controls

53 lines (41 loc) · 2.31 KB

Image

ASDP - a scalable size unit by Adhish

You must be developing app for that Android device in your pocket but wait, what happens when you try to run the same code on tablet or an Android mobile phone of different size or say an Android TV? Boom! The dimensions messes up. 😫

So, here is the solution to your problem! 😇

This is a very simple library which works with your sp and dp values for almost all Android devices. All you need to do is install this library into your project and call it with your sp (Example : 10sp) or dp (Example : 10dp). Once you specify this according to this libary, the layouts will automatically adjust itself according to the devices! 😮

Don't believe me? Here is the screenshots on Android TV, Nexus 5x and Nexus One 😌

Image

Installing

  1. Add it in your root build.gradle at the end of repositories:
	allprojects {
		repositories {
			...
			maven { url 'https://www.jitpack.io' }
		}
	}
  1. Step 2. Add the dependency
	dependencies {
	        compile 'com.github.adhishlal:asdp:1.1'
	}

And it's done. Just give the dimensions as @dimen/_<your value>asdp and it will take the sizes automatically!

Example

        <TextView
            android:id="@+id/tvExample"
            android:layout_width="@dimen/_50asdp"
            android:layout_centerInParent="true"
            android:layout_margin="@dimen/_5asdp"
            android:layout_height="@dimen/_50asdp"
            android:layout_gravity="center" />

Show Some ❤️

GitHub stars GitHub forks GitHub watchers GitHub followers Twitter Follow

Liked the work? [Buy me a cup of coffee] (https://www.paypal.me/AdhishLal) ☕