0

私が持っている各ビューに楕円を追加したいのですが、最初のレイアウトにのみ追加するようです。何か案は

ここに私のxmlコードがあります

<RelativeLayout
    android:id="@+id/first_plane"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >
</RelativeLayout>

<RelativeLayout
    android:id="@+id/second_plane"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >
</RelativeLayout>

これらは両方とも LinearLayout 内にあります

これが私が試しているコードです

DrawOval firstOval = new DrawOval(this, 400, 20, 650, 100); 
firstOval.setBackgroundColor(Color.TRANSPARENT);

ViewGroup firstLayout = (ViewGroup) findViewById(R.id.first_plane);
firstLayout.addView(firstOval);

DrawOval secondOval = new DrawOval(this, 200, 150, 450, 230);
secondOval.setBackgroundColor(Color.TRANSPARENT);

ViewGroup secondLayout = (ViewGroup) findViewById(R.id.second_plane);
secondLayout.addView(secondOval);

ありがとうございました

4

1 に答える 1