How to place a dynamic image on different drawable - java

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.

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.

UI for Android - What resolution to design for?

I'd like my app to work on phones (320x480 usually) and tablets (840x600, 800x600 and 1024x600).
I'm not sure which resolution to design for and how it would scale on various devices. Can anyone please suggest what resolution and dpi should I use?
Discussing this with Tim Bray in a conference he said:
You should design for the biggest resolution and the higher dpi and then scale to the smaller ones.
Right now I think that tablet version requieres a different layout with different UX. For instance I would try using Fragments on the tablet version of my app.
Have a look at this resource:
Supporting Multiple Screens
Android handles different screen resolutions automatically in that you specify sizes in "dip" (device independent pixels) and by providing different drawable folders (drawable-hdpi, drawable-mdpi, drawable-ldpi) where drawables are fetched depending on the resolution capabilities of the device your app is running on.
If you want to target tablets specifically, then I'd start coding for the Honeycomb system. Devices will be available soon ;) The SDK is already available on the developer.android.com site.
Recently i developed a android app its in the market by name Starrpartners in this i use the design of 320x480 as a target and putting the images in mdpi folder. it worked pretty well on higher resolution as well .
You can check it by making your app and running it on different resolution simulator .
Hope it helps :)

Having trouble getting my head around UI Graphics android

At the moment I have just targeted my UI graphics for the hdpi resolutions for android and this works flawlessly, the graphics are designed with 3 resolutions in mind with only the background image being altered really. Problem is the plan was to use the same images for hdpi (480x800 and 480x854) and as well as mdpi (320x480). But when I test it for mdpi with the images in both the -hdpi and copied into -mdpi it doesn't scale them down, do I have to resize all the images and have them duplicated for the mdpi screens?
Sorry if this is not very eloquent it is the first time I have done any UI design for android and still don't understand it properly.
Android should correctly use the right image when you use R.drawable and your images are in drawable-hdpi, drawable-mdpi etc. Since that is what I think you've described as what you've done, it hints that maybe you've hardcoded a size? Are you using ImageView and set a size for them? If so, did you do it in Java code or in XML? If in Java code the values would be in pixels, so 50px on mdpi screens will look larger than on hdpi screens. If you used XML did you again set a size with px? If so, you should use dp.

Categories

Resources