Ven*_*kat 27
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)
| 归档时间: |
|
| 查看次数: |
13778 次 |
| 最近记录: |