Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/intuit/sdp
An Android lib that provides a new size unit - sdp (scalable dp). This size unit scales with the screen size.
https://github.com/intuit/sdp
Last synced: about 1 month ago
JSON representation
An Android lib that provides a new size unit - sdp (scalable dp). This size unit scales with the screen size.
- Host: GitHub
- URL: https://github.com/intuit/sdp
- Owner: intuit
- License: mit
- Created: 2015-01-27T15:52:13.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2024-03-27T16:37:47.000Z (8 months ago)
- Last Synced: 2024-04-28T15:32:00.610Z (7 months ago)
- Homepage:
- Size: 1.15 MB
- Stars: 2,214
- Watchers: 71
- Forks: 477
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- awesome-list - intuit/sdp - An Android lib that provides a new size unit - sdp (scalable dp). This size unit scales with the screen size. (Misc)
README
![issues](https://img.shields.io/github/issues/intuit/sdp)
![Forks](https://img.shields.io/github/forks/intuit/sdp)
![Stars](https://img.shields.io/github/stars/intuit/sdp)
![Maven Central](https://img.shields.io/maven-central/v/com.intuit.sdp/sdp-android)
![License](https://img.shields.io/github/license/intuit/sdp)# SDP - a scalable size unit
An android lib that provides a new size unit - sdp (scalable dp). This size unit scales with the screen size. It can help Android developers with supporting multiple screens.for text views please refer to [ssp](https://github.com/intuit/ssp) which is based on the sp size unit for texts.
# Attention
Use it carefully! for example, in most cases you still need to design a different layout for tablets.# Example
[Here](https://github.com/intuit/sdp/blob/master/sdp-android/src/main/res/layout/sdp_example.xml) is a single layout built using sdp:![sdp example](https://github.com/intuit/sdp/blob/master/sdp_example.png)
And [here](https://github.com/intuit/sdp/blob/master/sdp-android/src/main/res/layout/dp_example.xml) is the same layout built using dp:
![dp example](https://github.com/intuit/sdp/blob/master/dp_example.png)
You can see that sdp scales with the screen size and the dp stays with the same size on all screen sizes.
# Getting Started
To add sdp to your project (Using Android Studio and Gradle):
add implementation 'com.intuit.sdp:sdp-android:1.1.1' to your build.gradle dependencies block.
for example:
```
dependencies {
implementation 'com.intuit.sdp:sdp-android:1.1.1'
}
```
See the [sdp_example.xml](https://github.com/intuit/sdp/blob/master/sdp-android/src/main/res/layout/sdp_example.xml) to see how to use to the sdp size unit.For easy mapping of designs to sdp units, one can create designs with 300 pixels screen width - in this case each pixel in the design corresponds to 1 sdp.
# Note
The sdp size unit calculation includes some approximation due to some performance and usability constraints.