I want to rotate an ImageView toward specific pivot and with special 
degree. I searched in Google and found some solution about this, but I 
didn't find complete answer about this (like this 
answer<http://stackoverflow.com/questions/7634540/rotating-imageview-in-android-api-level-11>
).

I tried to use this code, but ImageView didn't rotate! Just the background 
of it rotates (without rotating view rectangle)

public class ImageViewCustom extends ImageView {
    public Context M_context;

    public ImageViewCustom(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        this.M_context = context;
    }

    public ImageViewCustom(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.M_context = context;
    }

    public ImageViewCustom(Context context) {
        super(context);
        this.M_context = context;
    }

    public float xPivot;
    public float yPivot;
    public float degree;

    public void draw(Canvas canvas) {
        canvas.save();
        canvas.rotate(degree, xPivot, yPivot);
        super.draw(canvas);
        canvas.restore();
    }
}

So, how can I rotating ImageView without using Animation and just with 
overriding or adding rotate methods to ImageViewCustom ?

Thanks in advance :)

-- 
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