Saturday, 17 August 2013

Android: Rotate and size FrameLayout

Android: Rotate and size FrameLayout

I have much more familiarity with the iOS world, so perhaps I'm missing
some obvious, but here is my scenario and what I'm trying to accomplish. I
have a custom view within a frame layout. This gets inflated within a
fragment that is used in a couple different places, such as a linear
layout. I want to be able to dynamically rotate the custom view (or
contents) 90 degrees and re-size it properly fill.
So I have the following frame layout (white) with custom view (content)
that is loaded within a linear layout (red):


And I want this:


I found it very trivial to rotate like this:

However getting the stretching/scaling/translating I can't figure out.
I've tried a variety of LayoutParams (size, margins, gravity, etc.) and
can't get the magic right. I don't know if I'm just missing something
simple, or if I'm totally going about things the wrong way.
Thanks.

No comments:

Post a Comment