问题
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);
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?
回答1:
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.
来源:https://stackoverflow.com/questions/20218422/implementing-pan-and-zoom