androidxmladobeui-design

How to design Android UI xml file from Adobe Xd file reference?


I am new to android. I am doing a project, for UI reference I have adobe xd design. The task given for me was I have to design activity xml the same as adobe screen design. In adobe xd file the measurements are in pixels. But in android, we are using dp(dependency independent pixels). How can I design the same screen with the same measurements in android without having proper measurements in dp?

My question is how can I design xml layout from adobe xd sample?


Solution

  • You can use a library to handle your UI on different size devices.

    Try using the SDP library. For more info & usage, you can check it out over here

    Add this to your Gradle for using the SDP library.

    dependencies {
      implementation 'com.intuit.sdp:sdp-android:1.0.6'
    }
    

    And in your layouts instead of dp use spd. Soo it will match like your pixel measurements from the Adode design into any device screen size.

    instead of

    android:layout_width="35dp"

    use

    android:layout_width="@dimen/_35sdp"
    

    Let me know if you have any issues.