Rotated ( 90 degrees ) root ViewGroup
<p>I am trying to create ViewGroup based on FrameLayout that might be rotated 90 degrees CW / CCW and it still will be working correctly</p>

<p>So far my results are not so sucesful. So far it looks like that ( left side before rotation, right after; sorry for bright red )</p>

<p><img src="http://i.stack.imgur.com/sqZoI.png" alt="Rotated ViewGroup"></p>

<p><strong>Layout</strong> for Activity</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"&gt;

    &lt;com.example.TestProject.RotatedFrameLayout
        android:id="@+id/container"
        android:layout_centerInParent="true"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#00F"/&gt;

&lt;/RelativeLayout&gt;
</code></pre>

<p><strong>RotatedFrameLayout</strong></p>

<pre><code>public class RotatedFrameLayout extends FrameLayout {

    private boolean firstMeasure = true;

    public RotatedFrameLayout( Context context ) {
        super( context );
        init();
    }

    public RotatedFrameLayout( Context context, AttributeSet attrs ) {
        super( context, attrs );
        init();
    }

    public RotatedFrameLayout( Context context, AttributeSet attrs, int defStyle ) {
        super( context, attrs, defStyle );
        init();
    }

    private void init() {
        setRotation( 90f );
    }

    @Override
    protected void onMeasure( int widthMeasureSpec, int heightMeasureSpec ) {
        super.onMeasure( heightMeasureSpec, widthMeasureSpec );
    }
}
</code></pre>

<p>Some extra info</p>

<ul>
<li>I don't want to use Animation rotation because buttons aren't clickable that way</li>
<li>I don't want to use landscape mode because in landscape on screen navigation buttons took a lot of space on Nexus 7 ( this is the main reason why I am trying to greate that rotated </li>
<li>It seems that only left and right side of the screen are out of bounds</li>
</ul>
