I want to place a picture in an app on tablet, with resolution 1920x1200 and the picture is the exact same size, but the problem is the software buttons on the bottom have some height and make the picture pressed on the top and bottom sides... How can I know whats the height of the software buttons, and do I have to manually cut every picture, or can I make it programatically?
Or even better, can I just make somehow the picture take the whole screen, and the bottom end ot just go behind the software buttons?
You can try using this if you want to crop the overflowed part -
android:scaleType="centerCrop"
Or alternatively, you can use this if you want to stretch your image to fit the ImageView -
android:scaleType="fitXY"
Also if you want to Fit image into imageview, keeping the aspect ratio and then resize imageview to image, check this - Click Here
Related
I have images that have height much greater than width. They can perfectly fit in an ImageView with portrait orientation with fitXY.
However, my problem is with landscape orientation. My best scale I tried is centerCrop. Now I have a small problem: I want to give the user the ability to move up & down, because the height is not fit within screen.
How can I do that?
Note: The pages are in fact book pages. That is why I want to move up & down. I want to initially fit width, with top of image viewed. Then the user can move down to read rest of page.
I found now this perfect open source TouchImageView
I want to achieve the following:
a picture, as a background, which resize according to the screen size
I want to put button on top of this picture, while maintaining a proportional position to the picture width and height.
See the example:
The background is an image with the fill_parent settings for width/height.The yellow squares are buttons on top of this picture.
So, how can I keep the button on the exact same position on top of the picture with different screen size, using relative layout (or others layout)
The solution was to use the "Percent Support Library" as stated by #subhash
I have a Widescreen Image that i want to put into a horizontal scroll view, with it ftting the whole screen vertically(and letting me scroll horizontally) but it simply stays at half height and won't let me scale it higher (layout_height is set to "fill_parent").
I already thought about using the image in different source resolutions but i think i cannot cover all possible resolutions so that is not really an option i guess.
I also want to put buttons on specific locations onto that image and want them to move with the image if that is important.
I'm trying to create a 9-patch image that only stretches horizontally, and as you can see in the attached image, I drew only in the center top.
The second image in the preview (the middle one) shows what I think it's wrong. I just want to stretch the middle, so it makes no sense to me why it isn't displaying the right part of the image - the frill. The left part is OK, thought.
Any help is appreciated!
Edit: Added another image to show it with "show patches" and "show content" enabled:
The layout defines how much and in what direction an image gets stretched. A 9-patch can only define what parts of an image should be stretched and which parts not. You can basically exclude parts of the image from stretching. In your example the left and the right parts won't be horizontally stretched. They will, however, still be stretched vertically. Since you have selected nothing on the vertical side, the image gets stretched equally.
How does it look in-app? It may just be that the draw9patch tool is not previewing it correctly. Try stretching the window as wide as possible. Also checking the "show content" and "show patches" checkboxes might help to show you what the tool thinks is going on.
Also, be sure that the tray containing the stretch pixels is completely transparent, is exactly 1 pixel wide, and goes around the entire bitmap.
I would like to stretch and crop an image so that it shows full screen on a Android device.
For example, inside the red-rectangle above would be the only area displayed on the phone.
I want it to center and crop. If the height of the image is small than the height of the device, I want to stretch the image as well.
By the way, I don't NEED images to be cropped. I just want my ImageView to display only the reg-rectangle part given the landscape image.
Have you tried setting android:scaleType="centerCrop" on your ImageView in XML? If I understand what you're asking for correctly, it should do just that.