We can rotate any view in layout from default to any angle .
For example below ImageView in layout before rotating like as follows.
xml code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.ram.viewrotate.MainActivity"
tools:ignore="MergeRootFrame" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_launcher"
/>
</RelativeLayout>
If you want to rotate just add rotate property to the view for example i have added to imageview After adding rotation property view looks like as follows
xml code:
<ImageView
android:id="@+id/imageView1"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_launcher"
android:rotation="90"/>
For example below ImageView in layout before rotating like as follows.
xml code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.ram.viewrotate.MainActivity"
tools:ignore="MergeRootFrame" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_launcher"
/>
</RelativeLayout>
If you want to rotate just add rotate property to the view for example i have added to imageview After adding rotation property view looks like as follows
xml code:
<ImageView
android:id="@+id/imageView1"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_launcher"
android:rotation="90"/>
EmoticonEmoticon