android - Rotate an image on the entire screen -
I can not seem to rotate an image properly on the whole screen. The problem is that when the image rotates, you can see the background in some areas. I also need to fill the image to fill the screen, when it rotates, this layout is I have tried different levels without success.
& lt; LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" Android: layout_width = "fill_parent" Android: layout_heat = "fill_perrent" & gt; & Lt; ImageView Android: id = "@ + id / image" Android: layout_wind = "fill_parrent" android: layout_heat = "fill_parente" android: scaleType = "centerCrop" /> & Lt; / LinearLayout & gt;
And here's the code I'm using.
image = (ImageView) findViewById (R.id.image); Image.setBackgroundResource (R.drawable.back_big); Rot = AnimationUtils.loadAnimation (this, R.anim.rotation); Image.startAnimation (rot);
I start the animation in onResume
. As I said, the image is rotated, but when the background rotates the background areas are there I have tried to use a lot of images from the screen, but still I do not do what I want. I do not care that the external areas of the image are not visible. I just want the rotation to fill the screen. I think that ImageView
sets its width and height initially, and then, when it rotates, then it uses those dimensions. Is there a better way to do this?
You type the scale of your ImageView "centrerop". Unfortunately, there is no good documentation on the exact meaning of different types of types, but the name implies that the image is centered on the screen and the image crops into the exact size of the view. Thus, when you start rotating, you will see areas with background.
Try typing the scale on "center"
Comments
Post a Comment