ほとんどの画面が自分の GameView (View から派生したカスタム ビュー) でいっぱいになるようなゲームを作成しようとしています。
次に、画面の下部にメッセージなどを表示する領域が必要です。以下では、問題を説明するためにそこにボタンを配置しようとしています。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<my.GameView
android:id="@+id/gameview"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Action1" />
</LinearLayout>
これを実行すると、ボタンは表示されません。ボタンを GameView の前に移動すると、画面上部のボタンで機能します。上記のように、GameView は何らかの方法ですべての画面を取得しています。また、GameView に 1 の layout_weight を指定し、ボタンに 0 を指定しようとしました (逆も同様)。
GameView に onMeasure のものを実装する必要がありますか (まだ理解できませんでした)、それとも何か不足していますか?