I know this question has been asked many times but what is the best practice to design layout for multiple screen size My Graphic designer has created designs in 360 width * 640 height how can i calculate the values of margin and padding for all views in accordance to 5 inch and 4 inch phone and use those value for pizel perfect UI.
Asked
Active
Viewed 248 times
-2
-
yes i have read lot of answers but still i am not getting it.I haven't found any good article which tell in brief on how to calculate value of margins for all these devices – himanshu Aug 14 '18 at 11:15
-
can you post some links of those articles – Vivek Mishra Aug 14 '18 at 11:16
-
https://alvinalexander.com/android/android-screen-sizes-dimensions-xlarge-large-normal-small – himanshu Aug 14 '18 at 11:17
-
https://www.dev2qa.com/how-to-support-multiple-screen-size-in-android/ – himanshu Aug 14 '18 at 11:17
-
you already got so many answer and moreover you still haven't read about sw
notations for designing layouts. The pattern used in the link are deprecated long time ago. – Vivek Mishra Aug 14 '18 at 11:38 -
i have read but ultimately smallet screen width is not a challenge but height is – himanshu Aug 14 '18 at 11:48
-
https://stackoverflow.com/questions/32860815/how-to-define-dimens-xml-for-every-different-screen-size-in-android – Vivek Mishra Aug 14 '18 at 11:49
-
"how can i calculate the values of margin and padding for all views" -- ask the graphic designer. Nobody else can help you understand the design and how to interpret it. – CommonsWare Aug 14 '18 at 11:53
2 Answers
0
You can used this library 'com.intuit.sdp:sdp-android:1.0.3' for size unit scales with the screen size.
Hemant Parmar
- 3,740
- 7
- 24
- 48
Harish Rawal
- 226
- 1
- 14
0
its worked for me all screen size supported
To add sdp to your project (Using Android Studio and Gradle):
add implementation 'com.intuit.sdp:sdp-android:1.0.5' to your build.gradle dependencies block.
for example:
dependencies {
implementation 'com.intuit.sdp:sdp-android:1.0.5'
}
and how can you use in project?
in your xml just @dimen/_90sdp insted of 90dp
it will work good and show good size if you run in tablet 10 inch or 3.7 inch phone show nice sorry im learning enlgish :)
its example code :
<com.mikhaellopez.circularimageview.CircularImageView
android:id="@+id/pic_profile"
android:layout_width="@dimen/_90sdp"
android:layout_height="@dimen/_90sdp"
android:layout_marginTop="@dimen/_20sdp"/>
also You can use
dependencies {
implementation 'com.intuit.ssp:ssp-android:1.0.5'
}
for font size
its example code for textsize:
<TextView
android:id="@+id/name_profile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/_12sdp"
android:textColor="@color/white"
android:textSize="@dimen/_12ssp" />
-
its wrong code? i said if u want use sdp use implementation 'com.intuit.sdp:sdp-android:1.0.5' in depency and i u want change font size add to depency implementation 'com.intuit.ssp:ssp-android:1.0.5' what is wrong code? when it worked in my project? – Aug 14 '18 at 11:25
-
-
you want support all reso screen phone ? right? also you can read google document : https://developer.android.com/guide/practices/screens_support AND https://developer.android.com/training/multiscreen/screensizes if its was true tic in my answer ty :) – Aug 14 '18 at 11:36