如何制作可缩放的LinearLayout?

Bab*_*'el 4 android zoom

我有一个xml文件,我想做zoomable.

Ven*_*kat 27

在你的应用程序中使用此jar

1.为我想要应用缩放功能的视图创建一个新布局(R.layout.zoomableview).

2.将其放在ZoomView中.

3.然后将ZoomView放置到要显示可缩放视图的主容器中.

private ZoomView zoomView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_zoomable);

View v = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.zoomableview, null, false);
v.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

zoomView = new ZoomView(this);
zoomView.addView(v);

main_container = (LinearLayout) findViewById(R.id.main_container);
main_container.addView(zoomView);            }
Run Code Online (Sandbox Code Playgroud)