I'm working on an android App,and it's designed with numbers (margins etc) no relative things so I think I'll find many problems with different screen sizes so I thought of making a function which will keep the data in DIMENSIONS
file proportional to user screen size like ( User's screen size X dimen)/(the screen size which the app were designed on)
, so I want to know if this won't cause any problem on App working etc ..
Thank you =)
This example demonstrates how to support different screen sizes in Android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main.xml. Step 3 − Add the following code to src/MainActivity.java
May be you can try below library which manages all the screen size resolution automatically. You need to just add the dependency in your build.gradle file and you are done. Create three different Layouts Folder in your res folder for all devices and use the dimensions accordingly.
How To Support Different Screen’s. Basically we are mainly this things by three ways. 1. Explicitly declare in the manifest which screen sizes your application supports. 2. Provide different layouts for different screen sizes. 3. Provide different bitmap drawables for different screen densities. 1.
Explicitly declare in the manifest which screen sizes your application supportss To set up support for multiple device sizes in Android, add the <support-screens> element into the AndroidManifest.xml file. This field specifies which screen size support and which do not.
//Dimen
implementation 'com.intuit.ssp:ssp-android:1.0.5'
implementation 'com.intuit.sdp:sdp-android:1.0.5'
use this two library, ssp is for text size, and sdp is for margin, padding and layout size
android:layout_width="@dimen/_24sdp"
android:layout_height="@dimen/_24sdp"
May be you can try below library which manages all the screen size resolution automatically.
compile 'com.intuit.sdp:sdp-android:1.0.4'
You need to just add the dependency in your build.gradle
file and you are done.
You need to specify like:
android:layout_height="@dimen/_10sdp"
Instead of:
android:layout_height="@dimen/10sdp"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With