mirror relativelayout in android, no update -
i want mirror app use customized relativelayout class root view. works fine, habe 1 problem. if refresh in 1 element, mirrored not on physical location, won't updated. have correct coordinate, should updated, don't know how.
package de.etestdriver.everclock.gui; import android.content.context; import android.graphics.canvas; import android.graphics.point; import android.graphics.rect; import android.util.attributeset; import android.view.motionevent; import android.view.view; import android.widget.relativelayout; public class hudrelativelayout extends relativelayout{ public hudrelativelayout(context context) { super(context); this.setwillnotdraw(false); } public hudrelativelayout(context context, attributeset attrs) { super(context, attrs); this.setwillnotdraw(false); } public hudrelativelayout(context context, attributeset attrs, int defstyle) { super(context, attrs, defstyle); this.setwillnotdraw(false); } @override protected void dispatchdraw(canvas canvas) { canvas.scale(-1,1, getwidth()/2, getheight()/2); super.dispatchdraw(canvas); canvas.restore(); } @override public boolean dispatchtouchevent(motionevent event) { event.setlocation( getwidth()-event.getx(), event.gety()); return super.dispatchtouchevent(event); } }
Comments
Post a Comment