2012-03-20 3 views
0

私はゲームを作っています。キャンバス全体が画面を占めたくないです。 SurfaceViewをXMLに拡張するクラスを配置する方法はありますか?私はxmlに配置して、SurfaceViewの位置とサイズを画面上で調整できるようにしたいと思います。 SRCでxmlにカスタマイズされたビュー

答えて

1

:XMLで

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

<package.name.MySurView 
    android:id="@+id/surview" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 
</package.name.MySurView> 
+0

はあなたにethan_liouに感謝:) –

関連する問題