I came across another post to help me. But when I use FlipLayout in my
view all I get it a black screen. However if I change the rotation
from 180 to 0 all is drawn ok. But I want my screen upside down. Whats
going on here?

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.LinearLayout;

public class FlipLayout extends LinearLayout {
    private Matrix mMatrix = new Matrix();
    private float[] mTemp = new float[2];

    public FlipLayout(Context context, AttributeSet attr) {
        super(context, attr);
        mMatrix.postRotate(180);
    }

    @Override
    protected void dispatchDraw(Canvas canvas) {
        int sc = canvas.save();
        canvas.setMatrix(mMatrix);
        super.dispatchDraw(canvas);
        canvas.restoreToCount(sc);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent event) {
        final float[] temp = mTemp;
        temp[0] = event.getX();
        temp[1] = event.getY();
        mMatrix.mapPoints(temp);
        event.setLocation(temp[0], temp[1]);
        return super.dispatchTouchEvent(event);
    }
}

On Sep 19, 3:13 pm, rukiman <[email protected]> wrote:
> I have a need to rotate the views in my activities by 180 degrees. Any
> good suggestions on how to do this? Taking into account touch inputs
> still working. My activity is made up of several views in a
> linearlayout and also makes use of toasts.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to