I'm drawing a image that goes from x=0 to the end of the screen and beyond. I would like the screen to move to follow the image for at least 3 screen widhts. How can this be solved?
Thanks!
Related
I know this is a bit unusual, but I want to resize the bounds of an image without the image itself being scaled down.
For example, when I have an 200x200 image, and resize it to 100x200 the result should just be half of the image, where the other half is just cut.
Is that possible?
I don't know how you resize the image in your app, but if you resize any 200x200 image to 100x200, this result will be a part of your initial image, depending on the starting point.(could be the 1st half starting at pixel 0, the 2nd half starting at pixel 100 or any other half in between depending on the starting pixel)
Ok I have tried with many different ways rotating the ImageView using Matrix but I can't find how to rotate it without changing its size. I'm trying to rotate a circle, literally a purple circle. This is what happens:
When its on 0, 90, 180, 260 it have the correct size, but when the value is any one between those the image change it size.
Like 0-45 it gets smaller 45-90 it gets bigger until it reaches original size. I know that its doing it because even that the image is a circle its really a square bitmap.
Anyone can help me out?
What minimum API are you using ?
From 11, you can use SetRotationX, it should rotate the view without affecting the image.
I want to create an effect similar to Facebook Home Lock screen here. Images with Burns effect.
Images(wider than the screen) start with it's left part shown and scroll smoothly to right.
I've tried to View.animate.x(-50.0f) but the image appears cropped when it moves. (I used scaleType=center and the image is larger than the screen)
Any ideas?
Thanks
I'm writing a custom image crop.
I have an image view and a rectangle to choose area for cropping on it.
After cropping I need to know a top-left point of rectangle, that present cropping area.
But when i try to get it, Rect gives me a X, Y and width coordinates of the screen, not image. How can I get a real coordinates of the image?
I guess you could apply a simple proportionnality rule using the actual size in pixels of the device screen (assuming the image is displayed in full screen). You can easily get the screen size using this very complete answer: https://stackoverflow.com/a/1016941/1417179
From there, if your image dimensions is wh and the screen dimensions wshs, you can get the coordinates in image space using image_coordinates = screen_coordinates*w/ws.
You may have to cheat a little if the image displayed is not of the same aspect ratio than the screen, but the idea remains the same.
Hope this helps!
At last i finished my work and now i need to hand it to designer. App has some buttons and checkboxes.
So the question how big button and checkbox should she draw for each screen size(ldpi,mdpi,hdpi,xhdpi) or she could draw just one image for button and anotherone for checbox and it could be scaled?
Thank you already.
It really depends on how big your buttons are. U can check the following link for sizes:
http://developer.android.com/images/screens_support/screens-densities.png
But I agree with Mikelsreal (create a 9 patch image).
Create the button image in whatever size u like.
Add black pixels above the image to set where the image should be stretch horizontal.
Add black pixels on the left side of the image to set where the image should be stretch vertical.
Add black pixels on the right side where the content can be placed vertical
Add black pixels below the image to set where the content can be placen horizontal
rename the image like : yourImageName.9.png
and it should work.
for more info check (developer.android.com/tools/help/draw9patch.html)