Reputation: 23
I'm trying to rotate hole layout by this code:
RelativeLayout rll = (RelativeLayout) findViewById(R.id.relativeLayout1);
rll.setRotation(21);
how can I set rotation center?I don't want to use left bottom corner as rotation center,because some parts of rotated layout is out of the view!! (I don't want to use animation. bcz my buttons don't work correctly with it)
Upvotes: 1
Views: 527
Reputation: 4958
Not sure i understand what you are asking but try this:
int w = r11.getWidth();
int h = r11.getHeight();
r11.setRotation(21f);
r11.setTranslationX((w - h) / 2);
r11.setTranslationY((h - w) / 2);
Upvotes: 0
Reputation: 1584
The answer is here
Is there any way to rotate a button without using animation in android 2.1
here
Rotate a bitmap in android about a point without animation of view
or here
Upvotes: 1