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.
Related
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
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
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
I would like to ask if I'm developing a 4 inch based app device and has a 100x100 px image button, what would be my dynamic images to be placed on the drawables? xhdpi, hdpi, mdpi,ldpi and so on to make it responsive every time it is installed on different devices.
Did you checked out the related best practices for Multiple Screen supports from developer.android.com. It explains nicely how to make layouts fully responsive
Read this article thoroughly and you will get what you want.
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.