如何使可缩放的LinearLayout? [英] How to make zoomable LinearLayout?

查看:177
本文介绍了如何使可缩放的LinearLayout?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有,我想使可缩放的XML文件。请指引我。

I am having an xml file which I want to make zoomable. Please guide me.

推荐答案

使用罐子在您的应用程序

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

1.Create a new layout (R.layout.zoomableview) for Views that i want to apply the zooming functionality.

里面ZOOMVIEW 2.Place吧。

2.Place it inside ZoomView.

3.Then将ZOOMVIEW到你想要显示的缩放视图中的主容器。

3.Then place the ZoomView to the main container where you want to show the zoomable view.

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);            }

这篇关于如何使可缩放的LinearLayout?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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