Hi, everyone I want to rotate my view in specified degree, for example 30 degrees, 45 degrees. There is no rotate method in view class, I was trying to rotate its inside canvas, but the view doesn't rotate acordingly, please help! Here is my code section:
public class rotate extends Activity { float mDegree; /** Called when the activity is first created. */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); MyView tx1 = new MyView(this); tx1.setText("Rotate Me"); tx1.setBackgroundResource(R.drawable.bk_yellow); AbsoluteLayout l = new AbsoluteLayout(this); AbsoluteLayout.LayoutParams p1 = new AbsoluteLayout.LayoutParams( AbsoluteLayout.LayoutParams.WRAP_CONTENT, AbsoluteLayout.LayoutParams.WRAP_CONTENT, 10, 10); l.addView(tx1,p1); tx1.rotate(30); setContentView(l); } class MyView extends Button{ public MyView(Context c){ super(c); } @Override public void draw(Canvas canvas) { // TODO Auto-generated method stub //canvas.rotate(45, mStartX, mStartY); super.draw(canvas); //this.draw(canvas); } public void rotate(float degree){ mDegree = degree; this.invadate(); } } } Thanks for reply in advance! BR, -David --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---