【问题标题】:How to make zoomable LinearLayout? [closed]如何制作可缩放的线性布局? [关闭]
【发布时间】:2013-03-28 18:16:54
【问题描述】:

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

【问题讨论】:

标签: android zooming


【解决方案1】:

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

【讨论】:

  • @BlackTiger 我们可以在膨胀布局中声明哪个布局......
  • @N.V.R 我们可以在 inflate 布局中声明哪个布局......
  • 太棒了!它的工作:)
  • 太棒了! +1 并完成工作:)
  • 什么是 R.layout.zoomableview??
猜你喜欢
  • 2011-06-09
  • 1970-01-01
  • 1970-01-01
  • 2012-07-06
  • 2018-03-15
  • 1970-01-01
  • 2014-04-11
  • 1970-01-01
  • 2019-05-01
相关资源
最近更新 更多