Android xml的自定义视图
我正在做一个游戏,我不想让整个画布占据屏幕。有没有办法将扩展SurfaceView的类转换为xml?我想将其转换为xml,以便可以调整屏幕上SurfaceView的位置和大小。在src中:Android xml的自定义视图,android,android-layout,android-canvas,Android,Android Layout,Android Canvas,我正在做一个游戏,我不想让整个画布占据屏幕。有没有办法将扩展SurfaceView的类转换为xml?我想将其转换为xml,以便可以调整屏幕上SurfaceView的位置和大小。在src中: public class MySurView extends SurfaceView { public MySurView(Context context) { super(context); } // you must overide this constructor public
public class MySurView extends SurfaceView {
public MySurView(Context context) {
super(context);
}
// you must overide this constructor
public MySurView(Context context, AttributeSet attrs) {
super(context, attrs);
}
}
在xml中:
<package.name.MySurView
android:id="@+id/surview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</package.name.MySurView>