I have this ImageView in my layout:
<ImageView android:layout_width="fill_parent" android:layout_height="wrap_content" android:contentDescription="@string/image_divider" android:paddingBottom="8dp" android:paddingTop="4dp" android:scaleType="fitXY" android:src="@android:drawable/divider_horizontal_textfield" />
It's a horizontal divider. I want to rotate it 90 degrees so I have a vertical divider.
Is there any possible way to do it right here from the layout and not the Activity class?
rorateview.swiftlet bitmap: CGContext = UIGraphicsGetCurrentContext()! //Move the origin to the middle of the image so we will rotate and scale around the center. let newImage: UIImage = UIGraphicsGetImageFromCurrentImageContext()!
Drag the dots to the edges of your desired photo or tap Auto. To rotate a photo 90 degrees, tap Rotate . To make minor adjustments to straighten the photo, use the dial above Rotate . To automatically straighten the photo, tap Auto.
You can make a view clickable, as a button, by adding the android:onClick attribute in the XML layout. For example, you can make an image act like a button by adding android:onClick to the ImageView. In this task you create a prototype of an app for ordering desserts from a café.
You can use Available Since API Level 11
android:rotation="90"
Final Code to Put,
<ImageView android:layout_width="fill_parent" android:layout_height="wrap_content" android:rotation="90" android:contentDescription="@string/image_divider" android:paddingBottom="8dp" android:paddingTop="4dp" android:scaleType="fitXY" android:src="@android:drawable/divider_horizontal_textfield" />
Add "id" at ImageView (if not generate auto):
android:id="@+id/imageView"
and use the "id" (kotlin example):
val imageView = findViewById<ImageView>(R.id.imageView) imageView.setRotation(90f) // rotate 90 degree
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With