实施平移和缩放 [英] Implementing Pan and Zoom

查看:173
本文介绍了实施平移和缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在XML相对布局。一个按钮preSS我加入TI的意见是:

I have relative layout in XML. On a button press I am adding Views ti it:

   LayoutInflater inflater =
   (LayoutInflater)this.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
   View iv = inflater.inflate( R.layout.motor_block, null );
   //LinearLayout iv = (LinearLayout) findViewById(R.id.motor_block);
   RelativeLayout rl = (RelativeLayout) findViewById(R.id.layout);

   rl.addView(iv);

然后我使用OnTouch单独拖动每个观。是否可以平移和缩放为一组添加到所有的意见呢?

Then I am using OnTouch to drag each of the Views INDIVIDUALLY. Is it possible to add pan and zoom to ALL the views as a group?

推荐答案

的确是这样,你需要设置你的主要布局onTouchListener,加ScaleGestureDetector及其onScale方法里面,你可以操纵任何你想要你的看法。

yes it is, you need to set onTouchListener on your main layout, add ScaleGestureDetector and inside of its onScale method you can manipulate your views whatever you want.

这篇关于实施平移和缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆