I am working on a project for the university using Android.
I have a layout -XML- with a simple button, I would like to rotate it so that it is always in the same position, independently if the phone is in portrait mode or in horizontal mode
I'm just trying to rotate a button, I do not want any animation.
Here is my sample XML.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorWhite"
android:layoutDirection="ltr"
android:padding="5dp">
<Button
android:id="@+id/punto3"
android:layout_width="185dp"
android:layout_height="68dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:layout_marginTop="177dp"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:rotation="90"
android:text="3" />
</RelativeLayout>
FIRSTLY: I added: android:rotation="90" to rotate from horizontal to vertical my rectangle -button-.
Secondly: I check Design page, I got this: [https://i.stack.imgur.com/CPWyW.png
Question How can I rotate my button without animation or calculations? Just a simple turn. Something easy. Because I checked this questions: Android: Rotate whole layout.
Thank you for your time.