2013-11-26 53 views
0

我有XML中的相对布局。在按钮按下我加入浏览TI是:实现平移和缩放

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单独拖动每个观。是否可以将所有视图作为一个组添加平移和缩放?

+0

见我的答案在这里:[http://stackoverflow.com/questions/20225265/pinch-zoom-and-pan/20226476#20226476][1] [1]:HTTP:// stackoverflow.com/questions/20225265/pinch-zoom-and-pan/20226476#20226476 – beplaya

回答

0

是的,您需要在您的主布局上设置onTouchListener,添加ScaleGestureDetector,并在其onScale方法内部,您可以随意操纵任何视图。