Android用のカードゲームを作成しようとしていますが、レイアウトに問題があります。私は、左右に縦に並んだ5枚のカードと、上下に横に並んだ5枚のカードで構成されるメインゲーム画面をコーディングしています。私が抱えている問題は、他のすべてのカードが表示される余地がない場合、すべてのカードを横方向および縦方向に縮小する必要があることです。Androidビューで子供を縮小させる方法
以下は問題の写真です(わかりやすくするために、左と下のカードは省略しています)。あなたが見ることができるように、右側には4枚のカードしか表示されていません - 下のカードは部分的に不明瞭です。ビューは単にスペースを使い果たしているので、収まらないカードの残りの部分はドロップされます。私は画像を投稿することはできませんので、ここで
は、スクリーンショットへのリンクです:Androidは一番下まですべてのトップのカードと右のカードの高さを低くするために、私はこのような状況でみたい何image
ですカードが完全に表示されます。それは複雑に見えませんが、私はそれを働かせることはできません。私はRelativeLayoutを使って、下のすべてのカードをお互いに並べて配置し、右のすべてのカードを下に置いて、下の画像を作成しました(上のカードの右下に上のカードがあります)。私は自分のビューにすべてのカードを追加しようとしましたが、どちらもうまくいきませんでした。
提案がありますか?ありがとう!
OK、私はそれがより近くなった(下の画像のリンクを参照)が、今、私は逆の問題を抱えている - 私はそれを増やす必要があります。私はそれが私がスーツのために使用しているイメージを縮小したためだと信じています。あなたが見ることができるように、彼らはすべて小さいサイズに収縮しています。 LinearLayoutの可視部分の最後のボタンを描画せずに、すべての空き領域を使い切るために、各ボタンのLinearLayoutを水平/垂直方向に拡大するようにしたいと考えています。理想的には、スーツのサイズイメージを落とすことができ、適切にサイズを変更することもできますが、レイアウトエンジンで循環的なロジックや何かを求めているのでしょうか?
ここに私のXMLファイルがあります。 HandViewクラスは、各セットで5枚のカードを保持するクラスです。 5枚のカードの間に5ピクセルのマージンがあります。
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:shrinkColumns="*"
android:background="#FF00FF00">
<TableRow
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:background="#FF0000FF">
<com.herscher.euchre.ui.HandView
android:background="#FFFF0000"
android:layout_column="1"
android:orientation="horizontal"
android:id="@+id/northHandView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal" />
</TableRow>
<TableRow
android:layout_height="wrap_content"
android:layout_width="wrap_content">
<com.herscher.euchre.ui.HandView
android:layout_column="0"
android:orientation="vertical"
android:id="@+id/westHandView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<com.herscher.euchre.ui.PlayArea
android:layout_column="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/playArea" />
<com.herscher.euchre.ui.HandView
android:layout_column="2"
android:orientation="vertical"
android:id="@+id/eastHandView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:layout_height="wrap_content"
android:layout_width="wrap_content">
<com.herscher.euchre.ui.HandView
android:layout_column="1"
android:orientation="horizontal"
android:id="@+id/southHandView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
</TableLayout>
誰もが何か提案がありますか?
リック・モラニス – jmichalicek