Woops.  Throw a super(c); into the onDraw and you should be there, in
terms of the drawing of the view anyway.

On Feb 26, 10:59 pm, nderraugh <nderra...@gmail.com> wrote:
> I'm trying to do the same thing with a SeekBar subclass.  But I'm not
> having much success either.  Here's my code.
>
> import android.content.Context;
> import android.graphics.Canvas;
> import android.util.AttributeSet;
> import android.widget.SeekBar;
>
> public class SlideBar extends SeekBar {
>
>         public SlideBar(Context context) {
>                 super(context);
>         }
>         public SlideBar(Context context, AttributeSet attrs)
>         {
>                 super(context, attrs);
>         }
>         public SlideBar(Context context, AttributeSet attrs, int defStyle)
>         {
>                 super(context, attrs, defStyle);
>         }
>
>         protected void onDraw(Canvas c)
>         {
>                 c.rotate(90);
>         }
>
> }
>
> On Feb 17, 3:53 am, vistoda...@gmail.com wrote:
>
> > 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to