ユーザーが保持できる 8 つのアイテムを表示するビューを作成したいと考えています。使用可能なアイテムが 8 つ未満の場合、アイテムの imageView はデフォルトの画像に置き換えられます。
ユーザーがアイテムをクリックすると、レイアウトの上部にあるテキストボックスに各アイテムの説明が表示されます。この EditText は、画像「テキストボックス」の上に配置されます。これまでのところ、画像を editText にアタッチするオプションがあることに気付いたので、この問題は解決される可能性があります。
レイアウトの下部には、左側にキャンセル ボタン、右側に承認ボタンが必要です。このようにして、ユーザーはアイテムを選択せずにゲームに戻ったり、使用するアイテムを選択したりできます。
問題は、フル解像度で画像を描画するためのスペースが残っていない場合、レイアウトがコンテンツをフル解像度で描画しようとすることです。これが、アイテムの上段がフルサイズで描画され、2 行目が縮小されている理由です。
これは次のようになります。
次に、次のことを試しました。
- ルート レイアウトは線形レイアウトです
- 最初のレイアウトは相対レイアウトで、imageview と EditText を保持します。
- これらの後に、線形レイアウト (垂直) が続き、他の 2 つの線形レイアウト (水平) が親になります。
- アイテムを表す 4 つの imageView をそれぞれに配置しました。
私の結果はまだ完全に混乱しているので、これまでのところ、同意ボタンとキャンセル ボタンについては考えていませんでした。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="bottom"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/textboxview"
android:layout_width="fill_parent"
android:layout_height="70dp"
android:scaleType="fitXY"
android:src="@drawable/textbox" />
<com.gootsProject.AutoResizeTextView
android:id="@+id/dialogText"
style="@style/monologText"
android:layout_width="fill_parent"
android:layout_height="50dp" />
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/ImageView07"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:src="@drawable/item_noitem" />
<ImageView
android:id="@+id/ImageView05"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:src="@drawable/item_noitem" />
<ImageView
android:id="@+id/ImageView04"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:src="@drawable/item_noitem" />
<ImageView
android:id="@+id/ImageView06"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:src="@drawable/item_noitem" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/ImageView03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:src="@drawable/item_noitem" />
<ImageView
android:id="@+id/ImageView02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:src="@drawable/item_noitem" />
<ImageView
android:id="@+id/ImageView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:src="@drawable/item_noitem" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:src="@drawable/item_noitem" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
このビューを意図したとおりにセットアップするのを手伝ってもらえますか? 道に迷いました。