我是android studio的初学者。我想缩放包含其他视图的LinearLayout。可能吗?以及如何?
谢谢你。
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); }