Which resource qualifier to use for the android layout screen? - java

I am a beginner in android and is going to finish my first app, but encountering a problem that my screen layout does not fits all screen sizes,currently I have created different layouts for different screen sizes using 'size' resource qualifier. Should I use 'density' qualifier also along with size?
or ratio qualifier.I am having too much confusion. Please anybody reading this help me out.
My app will be focusing only mobile phones not any other device.
Please help.Thanks

use this android sdk from screen density pixel works for all the screen sizes with percentage of the screen ratio its a life saver
https://github.com/intuit/sdp

Related

Creating Same UI Supporting Different Screen Sizes?

I am Currently having designing problems in android studio.
I want to create UI which should looks same on every device but now i can't do that properly. i am using constraint layout and these are the screenshots :
For Android Screen Size 4.7 UI looks like below screenshot :
and For Android Screen 7.0 Size UI looks like this screenshot :
as the images shows the circular image on screen size 7 is pretty small and edittext is too looking worst.
How can i support both or more screen sizes while keeping the view like screen size 4.7.
Adaptive constraints can be used to achieve this.
For example, instead of putting an image view of say 100 * 100 dp, you can use specify the width in percentage of the screen size.
ConstraintLayout comes with many tools to help you with such as barriers, percentageWidth, chains etc.
A nice blog to get you started on the same : https://proandroiddev.com/getting-your-constraints-right-constraintlayout-786254ed1166
(I am the author of the blog)
Use SDP - a scalable size unit library for supporting different screens.
An android SDK 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.
Here is the LINK
To Support different screen sizes. Use ConstraintLayout. Google has solved the biggest problem for Android developers called Support different screen sizes by ConstraintLayout.
https://developer.android.com/training/multiscreen/screensizes

How to make a app scale the look the same on all devices (android)

I'm working on a app but I have a problem were buttons and images stay the same size on all screen size but I need to make the change depending on the size of the screen?
you have to design different layouts for tablets but for rest of the devices this library may help for achieving what you want .
https://github.com/intuit/sdp

Fixing Android apps size

Im just made my first little app on android.
I've been using the Android Studio for developing which is quite good but the problem is that the app I designed fits only a 5.5" display. On other devices its just very small or larger. I don't know how to make it autosize according to the size of the device.
Is there any way to fix it or is there any way to make different Apks for different mobiles (according to the display sizes)
PS: there isn't any picture in the app. Just writing and calculations. Kind of Calculator for beginners(ME). :)
If you dont have any images on your app, set your layouts and views width (when needed) to 'match_parent' instead of 'wrap_content' or a fixed size.
Set the parent layouts height to 'match_parent' and if you have a background that fits all the screen, set this too.
Check this for reference of LayoutParams values: http://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html
If you want to add images Go to http://developer.android.com/guide/practices/screens_support.html and try to understand all the concepts of densities independence and supporting multiple devices.

Layout problems on Samsung Galaxy Y S5360

I am new to Android Development. I have recently developed an app that supports Screen sizes of 3" to 4"! The problem is that When I run my app on my HTC Wildfire S (3.2") it works find the screen visuals are fine to see and it gives best resolution.
But when I run the same app on my Samsung Galaxy Y S5360 (3") a small portion of the screen vanishes at the spot I mean the screen visuals are not so much visible to see and gives bad visuals of screen.
Why it is so when I have set the screen size as ranging from 3" to 4". I am using Relative Layout and in the Eclipse IDE the Screen is showing so well also.
HERE is the Eclipse IDE image
HERE is my Samsung Galaxy Y S5360 Image: sorry for poor image.
YOU can see the problem of text at the bottom of cell phone image how can i fix this? please help thanks in advance!
First- never trust the eclipse plugin. Its buggy, and its an estimation anyway. You can use it to see if you're roughly right, but never expect it to look like that ont he actual device, much less on all devices.
As for your problem- the screen on your device is too small for your layout. You either need to cut out whitespace or shrink something. If you can find out the exact resolution of this device you could make a special layout for devices of that resolution.
This is a standard problem in android UI design- you're developing for a lot of screen, some of which are very small. If you want it to work on everything, you have to be very careful with the amount of content and empty space on each screen and test against a variety of resolutions and physical sizes.
A good way to get around this is to size everything in dp. 1dp=1/160th of an inch. Then you know how big a screen you'll show on.
My 2 suggestions are as below
1.Can you try using scroll view for your content
2. apply full screen to your app & change the current layout of the app(if in case of linear layout)

Programming For Various Screen Sizes in Android

I'm using the Canvas and the SurfaceView. I've explicitly mentioned the coordinates for various objects and fonts on the screen. The app runs perfectly on Samsung Galaxy S Advance but the objects are out of scope on smaller screens such as that of Samsung Galaxy Fit or Pop. How do i make it compatible for all screen sizes and pixel densities.
Using dpis seems out of the question as I'm not using any xml layouts.
Thanks in advance.
I think you should get screen resolution at run time and set pixels according to that.
According to the developer guidelines it is discouraged to do so (work with explicit coordinates). Please refer to the android design guidelines for how to do it better. If you cannot avoid it, you'll need to take into account the screen size and density and compute your coordinates accordingly.

Categories

Resources