I have Some Background image in to My Application. That background Image also contain the Button image. I am manualy create and set the Button on that Button image of the Background Image. now while the Screeen size changes for another device then the real button and the Button Image that show on the Background image shows different. How i can set it for the ProperView. Or if i want to make another Background Image that dont contain the Image of the Button. Then which Screen size should i have to prefer for different Device Competibility.
I have read this competibility documents. But not getting proper idea if i have to set the background image for all device then which screen size i have to prefer. So can any budy explain me in Short and Sweet ?
Thanks.
According to Supporting Multiple Screens, you have to create multiple layout folders!
For example: you can have 2 versions of my_layout.xml
res/layout-xlarge/my_layout.xml
res/layout-normal/my_layout.xml
Read Supporting Multiple Screens; There are lots of details there.
Read Supporting Multiple Screens; There are lots of details there.
Related
Hi I am developing an app for large screens (24 inch - 30 inch) and I need a way to make it easier for wheelchair users to use the app. The first idea I have is resize all activities to a percent (50%) and put layout to bottom left or right. But I dont know how it can be done and need help or a different solution for the problem.
What i want is with a button click resize activity layout to example below. orange color represents activity and black orange image is when activity size reduced to size.
You can set other xml which have difference size which make you can design your UI depend what type device user used. There four type size = small, normal, large, and extra large (CMIIW). You can use this for reference
Adapt layout to all screen resolution - Android
https://youtu.be/th9YQ8nmhNg
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.
I hired a designer to help me redesign the UI for my Android app. For each Activity he gave me an image for the background, which includes any static content like fancy frames for text content; plus images for the buttons, which must fit in to the background image in exact places, to fit into the frames in the background image.
However, since Android devices have different screen sizes and aspect ratios, it's easy to fit the background image by itself with android:scaleType="centerInside", but how can I get all the other images to fit in with background exactly, to the pixel? If they didn't have to fit in with the background, I would just set the exact width and height for each ImageButton, but depending on how the background scales (based on the screen size and ratio) they might end up not aligned correctly.
Thank you very much in advance.
Update:
Is there some way I can have an entire view (e.g. a RelativeLayout) scale inside the screen, like the way the image scales inside the ImageView with scaleType="centerInside"? If so, I would be able to set the RelativeLayout's size to the same as the background image, and put all of the other buttons / images in their places relative to the background image, and then just have the whole thing (the RelativeLayout containing all the other views) center inside the phone's screen.
Your approach is wrong (or at least bad), because android devices offer screens not only with different sizes but also with different densities. What you shall read now is Designing for Multiple Screens first. Then understand that non scallable bitmaped UI will rather not work as you imagine. You need to support screen sizes which means your UI elements (like i.e. buttons, lists, headers etc) shall scale. There's lot of possibilities to deal with this, one is using 9-patch bitmaps (randomly chosen tutorial on the 9-patch).
Also, please read this article: Supporting Multiple Screens
When desining UI it suffices to assume you design for mdpi density. Once your layout is done you create drawables for i.e. mdpi and hdpi (and put under the same names into res/drawable-mdpi and res/drawable-hdpi respecitvely). Layout files remains unchaged but framework would automatically pick right asset so your UI will look sharp as long as you provided drawables for that density. Please see Providing Resources article as well.
I have a full screen png image with all descriptive text for each EditText. I want to place the six EditText input areas at the correct positions on the screen.
I understand the different layout folder names for different screen sizes, densities and orientations. So I would have different layout XML files for each.
My problem is how to place the EditTexts at the correct location, and have them scale what would be small amounts with the small variations of sizes as the full screen png image will scale.
I believe that I should not specify locations, even with density independent pixel (dp |dip), as they may not work in future versions.
I cannot find anything on searching for this problem. What I can think of is a Relative Layout with blank or transparent dummy TextViews pushing the EditTexts to the correct positions.
My reasons for doing it this way with one png image for all the non-EditText parts of the screen are (I think)
- Can get a nicer screen image
- Is more efficient to place one png ImageView on the screen
- Is how it was done in another mobile environment
Any thoughts or suggestions?
My recommendation is that you remove any text parts and other that needs to be aligned from the background image, then create a RelativeLayout where you can add these as real TextViews/EditTexts.
This will give you the best result and flexibility considering all the different screen sizes and resolutions available for Android phones and tablets.
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