如何用两根手指滚动位图?
谁能告诉我如何用两根手指滚动位图,因为在我的应用程序中我用一根手指来绘画。由于我想绘制整个图像(它可能比屏幕大),用两根手指滚动会很方便吗?
Can anybody tell me how to scroll a bitmap with two fingers, because in my app I am using one finger to paint. Since I want to paint an entire image (it may be larger than the screen) scrolling with two fingers would be convenient?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里Img类代表带有大位图的View,它显示其当前可见的矩形。 int numPointers = event.getPointerCount();
if (numPointers > 1) { - 在这里你可以得到触摸屏幕的手指数量。因此,如果它大于 1,则大图像将滚动,否则,您可以实现您的绘制逻辑。
Here Img class represents the View with a large bitmap, which displays its currently visible rectangle.
int numPointers = event.getPointerCount();
- and here you get number of fingers, that touch the screen. So if it is greater than 1, large image will be scrolled, otherwise, you can implement your paint logic.if (numPointers > 1) {