Android: Stretch Widescreen Image to fill the whole screen - android

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.

Related

Pictures in landscape mode on 1920x1200 tablets appear pressed

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

how to fix android scrollView height?

I'm trying to create a layout with multiple buttons, But all buttons was not displayed on Screen, So i used scroll view but now i have one problem because of background image (which is of high resolution). Now i'm getting very large empty space under after buttons. Please suggest a solution how can i fix scrollView hight so that it doesn't show the space under buttons.
like This :Area with white background is Moblie visible screen and off white area is background image.
The best solution would be to use an appropriately sized image. If you only want to display part of the image, but the image is a high resolution image, then you are wasting resources by loading the entire image.
You could enclose the ScrollView within another View, and set the background of your parent view to be whatever background you desire. Set the height of both views correctly and you should achieve your desired result.
The hierarchy would be
View (with background image)
ScrollView with buttons

Specifying imageView to resize as percentage of screen

In Android I need to have a simple layout to be designed using XML layout (rather than programming):
I need to have the following :
1- small image view on the left (centered vertically)
2- Three image views a bit larger beside each others (also centered vertically)
3- Small image view on the right side (centered vertically)
so the 5 images are adjacent horizontally and centered vertically.
This is simple, anyhow the question is how to specify the image views to resize as percentage of the screen height ?
So if I specify the three image items to be 60% of screen height, I expect the imageView to resize (including the source image) to be 60% of screen height.
Is it achievable?
Thanks
Yes, it is, Take a LinearLayout(Horizontal) and then to all the childs(Imageviews here) give layout:height="0dp" and layout:weight=".6" , try this first and update questions if you have any further

Tying images to one another and scaling?

I have an application that needs to scale an image in relation to another image due to different screen size, I have an image that is essentially a background that matches the width of the screen and another image in a relative layout that is aligned so it fits on my phone in 2.2 but when seen on 2.1
Or ... i could just use something that scales the image as a percentage. Suggestions?
edit:
I guess all i need is to know how i can keep an image in a spot relative to another using relative layout and scale it through a percentage, different screen size will scale the other image but not this one because the other image fills the parent so when the screen size is smaller it just scales it down, however the one i need to scale does not because it doesn not fill the parent.

Android Layout Manager scaling images

I am using the Linear Layout Manager and I am trying to use the image width and height (wrapContent) automatically within the application. However, all of the images are appearing larger than what they should be. I think I know why: If I put an image that is 320X480 on the screen, on my device that has a pixel resolution of 480X800, it fills up the entire screen. This results in all of my images being too big for this screen, as I am building my images for a screen size that is 480X800.
Does anyone know how to fix this?
u can use absolute layout!
and can set the width and heigth of the image as u want!
go to the layout xml page and then change it to Absolute layout.
then you can easily change the the width ..
right click -> property
set the height and wigth as u like... Eg:"120dip"
it will solve your issue..
if not let me know will provide you another alternative

Categories

Resources