How to support multiple screen sizes on Android - android

I'm developing an apps for both phone and tablet, but the problem is that when we run it on a tablet then the image that we have used in the app doesn't stretch and looks different. But we want to develop it like on the phone. Is it possible or not if yes then how? I have used image .jpg and .png.I think the problem is the image, the java code is perfect.

See Android Developers: Supporting Multiple Screens

In order to be independent of screen size, use dp (dip) instead of px when you design your xml-layouts. And use sp when you define text-size.

You should provide properly sized image resources for the different screen sizes. This can be accomplished in Android using the built in Resource system.

You can use the sdp sdk. It enables you to use the sdp size unit which fits to the screen size.

Related

how to get same image size in android studio for different phone

I want to have a image (0.5in*0.5in) for my game for all devices but image size changes for different device.
I used 0.5in( not dp) as layout width and layout height.I am working on android studio 2.3.3
for different Android devices, Android deal with Images with different densities with these standards mdpi:hdpi:xhdpi:xxhdpi:xxxhdpi, there are many ways to convert your Images to these standards and it's boring to use photoshop to do that so these links will help you to change the size of your Images easily.
https://romannurik.github.io/AndroidAssetStudio/nine-patches.html#&sourceDensity=320&name=example
and https://github.com/leocadiotine/fred
this one is awesome

Android : Auto resize view for small screen

There is a solution to resize automatically the views of my android app?
I've optimized it for 7" screen.
But now I want to use it on 3.2" screen and it's looking horrible!
I've you got some ideas or I have to do it manually?
This would be the first stop I would recommend:
http://developer.android.com/guide/practices/screens_support.html
This document explains the screens-support features provided by the platform and how you use them in your application. By following the practices described here, you can easily create an application that displays properly on all supported device screens and that you can deploy to any device as a single .apk."to any device as a single .apk.
and check this pdf: http://www.vanteon.com/downloads/Scaling_Android_Apps_White_Paper.pdf
Define sizes/dimensions in the dimens folder, and set sizes to your Views programatically through Java.
Or, you could set the size based on some ratio, according to the screen size. I mean, you can calculate the width/height of the screen during runtime and make the dimensions of your view screenwidth/x.
Please read this tutorials from Android developers:
Supporting Multiple Screens
Designing for Multiple Screens

How to use One Image for support all screen and density devices in Android

Here i develop one android application and i have one image with size 197*253, taht size is used for tablet. but i want to use in small screen device and mobile screen devices.
In this case can i use nine-patch image concept.
Please help me,
Thanks in Advance,
Depends on the purpose of your image in your app.
If it is meant to be stretched (Like buttons and layouts' backgrounds), then NinePatchDrawable is the solution. To convert your .png to a 9-patch, follow these steps.
If your image is an icon image (like Launcher, Action Bar, Menu and Notification icons), then you should use different .png's for different sizes. You can generate those different sizes manually (by using Photoshop or whatever tool you use to adjust the proper size) or you can use these tools to generate them automatically.

How to Develop only one android application for both phones and Tablets?

i want to develop an application that support resolution for both phones and tablet and for both layouts protrait and landscape .So can any one suggest me what i have to do for that ?
Thanks in advance .
These links should help:
http://developer.android.com/guide/practices/screens_support.html
http://developer.android.com/guide/practices/tablets-and-handsets.html
http://developer.android.com/training/multiscreen/index.html
I created a tool that allows you to scale/adjust your layouts for tablets and small screen devices and made a blog post about it here: http://onemanmobile.blogspot.com/2012/04/how-to-scale-your-android-layouts-to.html
Basically, defining your layouts in dp units for one size is not enough if you want your app to fit on all devices and tablets, since there's four different "density-buckets". This tool will allow your layouts to be converted into fitting these density buckets.
It really depends on the type of application. I've been doing raw drawing in OpenGL and with SurfaceViews, so I make sure I get viewport or canvas height and width and scale things accordingly.
If you have very specific UI elements, take into account DPI to ensure a button or widget is a minimum size.
See this link: http://developer.android.com/guide/practices/screens_support.html.
You can place your xml-Layouts for Tablet in 'layout-xlarge-land' and for phones in 'layout-large-land' or in the normal layout-land. For Portrait-Mode just place you xmls in 'layout-port'- Folders.

Images are shrinking in my application - Android

I developed an application for android. I am having a problem with the display of my application on my mobile. I am using the HTC wildfire mobile having a resolution of 240 x 320. When I loaded my application into mobile the images which I used in my application became small ( Shrinking) look and feel is so bad. It is showing somewhat good in the emulator.
How can I get the actual images in my application (Without shrinking )?
Can anybody help me, please?
Thanks and Regards,
Kiran.
Different display resolutions on android phones
Are you fixing the size of the ImageView to be particular pixels? like 140px? don't do that, use wrap_content or fill_parent instead. use a mix and combination of various layouts to achieve what you want. try to never fix the width/height by specifying pixels, if its extremely necessary, use dip instead of px.

Categories

Resources