如何制作可缩放的LinearLayout?

时间:2013-04-06 09:14:23

标签: android zoom

我有一个我想要缩放的xml文件。

1 个答案:

答案 0 :(得分:26)

use this jar in your application

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);            }
相关问题