Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handling all screen sizes android

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 =)

like image 234
Amine boujida Avatar asked Jan 06 '17 03:01

Amine boujida


People also ask

How to support different screen sizes in Android?

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

How to manage all screen size resolution automatically?

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?

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.

How to declare in the manifest which screen sizes your application supportss?

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.


2 Answers

//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"
like image 91
Harshil kakadiya Avatar answered Sep 21 '22 23:09

Harshil kakadiya


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"

like image 36
Pranav Darji Avatar answered Sep 19 '22 23:09

Pranav Darji