title: when trying to rotate layout image goes out of screen
body: <p>I'm trying to rotate a layout that incluedes an image. When pressed a button layout is rotating but it goes out of screen. I have tried to rotate like this;</p>
  
  <pre><code>  private void changeRotation(float rotation) {
      layout.setRotation(rotation);
      layout.setTranslationX(0);
      layout.setTranslationY(0);
      layout.requestLayout();
      isRotated = true;
      newRotationValue = rotation;
  }
  </code></pre>
  
  <p>My layout is like this ;</p>
  
  <pre><code> &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_gravity="center"
      android:background="@drawable/transparent"
      tools:context=".activity.CropActivity"&gt;
  
      &lt;LinearLayout
          android:id="@+id/layout"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:gravity="center"
          android:orientation="vertical" /&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_gravity="bottom"
          android:layout_margin="8dp"
          android:orientation="horizontal"
          android:weightSum="3"&gt;
  
          &lt;info.hoang8f.widget.FButton
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_gravity="top|center"
              android:layout_margin="8dp"
              android:layout_weight="1"
              android:drawableStart="@drawable/ic_camera"
              android:onClick="cameraBtnClick"
              android:padding="16dp"
              android:text="Camera"
              android:textColor="@color/colorPrimaryDark"
              app:cornerRadius="16dp"
              app:fButtonColor="@color/colorAccent"
              app:shadowColor="@color/colorBlack"
              app:shadowEnabled="true"
              app:shadowHeight="2dp" /&gt;
  
  
          &lt;info.hoang8f.widget.FButton
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_gravity="top|center"
              android:layout_margin="8dp"
              android:layout_weight="1"
              android:drawableStart="@drawable/ic_gallery"
              android:onClick="galleryBtnClick"
              android:padding="16dp"
              android:text="Gallery"
              android:textColor="@color/colorPrimaryDark"
              app:cornerRadius="16dp"
              app:fButtonColor="@color/colorAccent"
              app:shadowColor="@color/colorBlack"
              app:shadowEnabled="true"
              app:shadowHeight="2dp" /&gt;
  
          &lt;info.hoang8f.widget.FButton
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_gravity="top|center"
              android:layout_margin="8dp"
              android:layout_weight="1"
              android:drawableStart="@drawable/ic_rotate"
              android:onClick="rotateBtnClick"
              android:padding="16dp"
              android:text="Rotate"
              android:textColor="@color/colorPrimaryDark"
              app:cornerRadius="16dp"
              app:fButtonColor="@color/colorAccent"
              app:shadowColor="@color/colorBlack"
              app:shadowEnabled="true"
              app:shadowHeight="2dp" /&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>If image is fullscreen there is no problem. but image is like this something goes wrong.</p>
  
  <p>Before <a href="https://i.stack.imgur.com/HOtof.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HOtof.png" alt="ss"></a></p>
  
  <p>After (press rotate button) <a href="https://i.stack.imgur.com/NuROV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NuROV.png" alt="ss"></a>.</p>
  
  <p>how to solve this problem ? Please help me, thanks </p>