What picture size to use in Android layouts - android

I have an ImageView in Android with a foto in it. That view should always have the same proportions no matter which device it is displayed on. In my example the width of the ImageView is 427 dp and the height is 250 dp. I choose this special width to make the picture cover the whole width of the layout in Android studio. Now my question is, how should I modify the raw pictures taken from my camera (or whatever device/tool) such that it fits to the desired proportions? I mean, the raw picture does not have the desired proportions. This is why I extracted an ereas out of the picture with the desired proportions. I could specify the pixels for that in the tool I use (IrfanView). The proportions shoudld be multiples of 427 and 250, meaning that the following options are possible (427, 250) (2 * 427,2 * 250) (3 * 427, 3 * 250) etc. Now I do not know what size to choose. The ImageView might need different proportions depending on the device it is displayed on. Does someone have a good advice how to do that. Here you see a screenshot of the ImageView
Update: As nobody has answered so far, I would like to ask you again, how I should decide about the size of pictures in Android given that the app would run on different devices with different screen sizes. What is your way of deciding about that?
I'd be happy for every comment
Update 2: Can nobody help me with that? This should be a common problem. I mean you create an app for different devices and you need a picture for that app. What size should the picture have.
Why does nobody answer? Is the question itself unclear? If so please tell me.

try this i think you need two define two dimen files. one for normal phone and one for tablet. One size define in all dimen files. if you load in mobile normal fonts which you define for mobile will be load, if tab then tab font size.
How to define dimens.xml for every different screen size in android?

Related

How big of an image do I need if it will be used as an iPhone app's background cover?

Suppose I want to make something where an image covers up most or all of the app's background, like this:
http://www.useronboard.com/how-slingshot-onboards-new-users/?slide=12
What is the minimum dimensions I would need? I know you need to get a higher resolution with iPhone apps.
It totally depends upon device/orientation for which you want to do so ideally it should not be less than screen resolution of that device.
For example: iPhone 6 display resolution is 1334x750 so you need image of that size to avoid any pixlation or disturbed aspect ratio issue.

Another topic about background image sizes

Let's imagine I want a picture of my dog as a background picture of a layout, and I want my application to be running on every smartphones.
I've read a lot of articles about this, and I just want to be certain that my dog will still look like a normal dog even if I use a tablet, a Nexus 5, or a moto G.
This subject is really similar to my problem:
Android: Background Image Size (in Pixel) which Support All Devices
According to the comments, it's not possible to have one image per resolution, because we have too many resolutions for android.
I just want an image of my dog as a portrait background.
Is it possible to do it? What is the easiest way to do it? What if my layout height is not exactly equal to the device screen height, but the device height minus another layout (fixed size) ?

How to can I create an image that can be used for different android screen sizes?

I created an image to use for an android splash screen and it displays properly on my phone however when I open the app on a phone with a larger screen it pixelates. So I was wonder if I should create more than one image and if so what sizes should I set for other images because I know I can't use the same sizes as I used for the app icon?
If the images are pixelated
then you need to add larger images for each screen size under your
res folder. sizes depends on your target
or
scale the images. to be safe, make it bigger
it might help you: am I supposed to make images larger for tablets, or same size as handset?
you could probably use draw-9-patch to state which area of the picture can be extended.
Google draw-9-patch
I worked with two approaches so far:
Screen composition
One approach can be using a composition of brackground and a logo. You can have the logo as big as you need (for high resolution screens) and the background as a repeatable texture (it all depends on your design approach) or a gradient or other composition (less prone to pixelation errors).
As big as possible approach
If one image is your approach, you should do a research to know the currently most used and biggest android screen used (https://developer.android.com/about/dashboards/index.html). Knowing that one, you can design your image for that [high] resolution and set the scaleType as CENTER_CROP. With that, you will ensure that the image will be centered, inside the screen, keeping aspect ratio, and at its highest resolution [keep an eye about logos/graphics positions if you want to be sure that they remain visible even in thin screens).
For icons, the best way is Draw 9-patch
Otherwise, you need to scale the images into drawable-xx (res directory), here the explanation

put background with specific size and position

i'm working on an Android application and i'dd like to put a background image. my problem when i set the android:background is that the image is show on all the screen.
i'dd like to have my background on only 50 % height and wide.
thank you
This depends on screen size of devices. I recommend that You read about supporting multiple screen sizes:
http://developer.android.com/guide/practices/screens_support.html
You can also do this programmatically, but is a bad practise. To get the result You want, You have to set a layout.xml for every screen size. It is also recommended that You better put that image inside an imageView, because of a good scaling on different devices.

Android: Background image / imageView for different screens

I want to set a background image to my Activity. I am just using an imageView in a relative Layout and position the other elements as I want them. Now we have a million, or at least quite a few, different screen sizes and densities. I wonder how I can achieve having the right image for all these devices.
I don't want to scale/stretch my image.
The image is in a way that it is lets say 2000 x 2000 pixels (or whatever you like) it doesn't matter what part of this image is displayed. In other words I could crop any needed image size out of this extra large image and display only that portion.
How can I achieve this?
Thanks,
A.
Just set your image view android:scaleType="center" and it won't scale or stretch.
Have a look at the scaleType options at the following link. This gives you a decent amount of control over how an image is rendered.
http://developer.android.com/reference/android/widget/ImageView.ScaleType.html
Also have a look at the following link. You can provide resources with the same file names in different folders, and the system will choose the most appropriate. This way, you can know more or less what size screen you are targeting with each image and you can create your images at a size that will perform the least cropping (or possibly no cropping at all).
http://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources

Categories

Resources