I will just rotate min to max
. But for this I have used several images to show progress Can someone recommend me a way to use an image that can rotate at maximum one angle from the minimum.
I know there are two possible ways to achieve this.
- Use of animation classes
- Custom
I will rotate this image just by using any number of SeekBar
< / P>
To touch an image
Private zero rotate (float degree) {last rotate animation rotate element = new rotate animation (0.0f, degree, rotate animation RELATIVE_TO_SELF, 0.5 F, Rotat Animation. RELATIVE_TO_SELF, 0.5F); RotateAnim.setDuration (0); RotateAnim.setFillAfter (true); Imgview.startAnimation (rotateAnim); }
second approach
imageView.setRotation (angle); // matrix matrix matrix = new matrix (); Can use the matrix; But I'm going to API & gt; = 11
imageView.setScaleType (ScaleType.MATRIX); // essential matrix.postRotate (float angle, pivX, pivY); ImageView.setImageMatrix (matrix);
How can I set SequeBar Minimum and Maximum to Start and End Angle? Which approach is better and should I put it in FrameLayout
to rotate it with freely
You can do this like:
// basic Load bitmap (500 x 500 pixels) bitmap bitmap.org = bitmapfichter Decode processing (getResources (), R.drawable.android); Int width = bitmapOrg.width (); Int height = bitmapOrg.height (); Matrix matrix matrix = new matrix (); // bitmap matrix PostRotate (45); // The size of the new bitmap bitmap has been resized to Bitmap = Bitmap.SerateMap (bitmaporgh, 0, 0, width, height, matrix, true); // Allow setting to set up Biltmap with a bitmap; // image view, image button or any bitmap drauble BMD = to set new bitmaprodvate (resized bitmap); // ImageView imageView.setImageDrawable set on Drawable (BMD);
Check this for details.
matrix. PostRotate (45); // is the angle degree to rotate here 45
No comments:
Post a Comment