Android:是否可以将活动加载为视图?

Android:是否可以将活动加载为视图?,android,Android,比如说 视图v=MapActivity.class 下面是一个活动,但当我尝试使用适配器构建视图时,它不起作用 setContentView(R.layout.zoommain); mZoomControl = new DynamicZoomControl(); mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.image800x600); mZoomListener = new LongPressZ

比如说

视图v=MapActivity.class

下面是一个活动,但当我尝试使用适配器构建视图时,它不起作用

    setContentView(R.layout.zoommain);

mZoomControl = new DynamicZoomControl();

mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.image800x600);

mZoomListener = new LongPressZoomListener(getApplicationContext());
mZoomListener.setZoomControl(mZoomControl);

//not working... loading custom view
mZoomView = (ImageZoomView)findViewById(R.id.zoomview);
//mZoomView = (ImageZoomView)context.getResources().findViewById(R.id.zoomview);
//context.getResources()
mZoomView.setZoomState(mZoomControl.getZoomState());
mZoomView.setImage(mBitmap);
mZoomView.setOnTouchListener(mZoomListener);

mZoomControl.setAspectQuotient(mZoomView.getAspectQuotient());

resetZoomState();

视图
不是层次结构的一部分<代码>视图v=MapActivity.class没有多大意义

如果查看是同一应用程序中活动的一部分,则可以执行以下操作:

View view = findViewById(R.id.zoommain);
假设您给了主布局一个id
zoomain


或者,您可以创建自己的自定义布局,实现自定义的
侦听器
,然后在多个
活动

中重用它,非常感谢。这就是我需要的解释。
View view = findViewById(R.id.zoommain);