DrawVが Android View (または View を拡張) の場合、それを通常の xml レイアウト ファイルに含めて、そのレイアウト ファイルをsetContentView(int).
レイアウトでクラスを参照するDrawVには、完全修飾名を (パッケージと共に) 使用する必要があります。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/buttons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/button_one"
android:text="One"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.0" />
<Button
android:id="@+id/button_two"
android:text="Two"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.0" />
</LinearLayout>
<com.example.views.DrawV
android:layout_below="@id/buttons"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
上記の RelativeLayout はルート ビューです。LinearLayout はbuttons、2 つのボタンを保持し、それらを同じ幅に保つためだけの ViewGroup です ( と が等しいことに注意してくださいlayout_width=0dp) layout_weight。ビューDrawVはビューの下に配置されbuttons、親コンテナーの幅と高さに一致します (塗りつぶします)。
これを の下に保存すると、Activity でsrc/main/res/layout/activity_circles.xmlを使用してレイアウトを設定できるようになります。setContentView(R.layout.activity_circles)