是否可以让用户只触摸屏幕一次?
含义:用户触摸屏幕,如果他再次尝试触摸屏幕,则不会发生任何事情.我正在实现使用canvas在屏幕上绘制对象的方法.
先感谢您!
我有一个矩形:Rect r = new Rect();.我想将r对象旋转到45度.我检查了解决方案,我发现它可以用矩阵完成:
Matrix m = new Matrix();
// point is the point about which to rotate.
m.setRotate(degrees, point.x, point.y);
m.mapRect(r);
Run Code Online (Sandbox Code Playgroud)
问题是乳清我传递r给m.mapRect(r);它抱怨r应该是从类型RectF.我成功地做到了:
RectF r2 = new RectF(r);
Matrix m = new Matrix();
// point is the point about which to rotate.
m.setRotate(degrees, point.x, point.y);
m.mapRect(r2);
Run Code Online (Sandbox Code Playgroud)
但问题是,我需要从类型的对象Rect不是RectF.因为我将r对象传递给正在接受Rect对象的外部类.
是否有另一种方法来旋转矩形r窗体类型,Rect除了这个方法,并且没有旋转整个画布(画布包含一些其他元素)?
先感谢您!
此致,Dimitar Georgiev