我正在爲玩一個交易卡遊戲的Android應用程序編寫GUI。我有使用多個視圖的戰場佈局代碼。我需要製作一個代表甲板的物體,並且還需要在手中/戰場上代表一張牌。長時間攻擊時需要提供選項菜單(攻擊,防守等),或者當雙手輕擊區域(綠色)需要移動到戰場時(藍色)。我不確定我可以用什麼樣的xml對象來做到這一點,因爲它需要動態地發生並從後端代碼(卡片名稱,圖像)獲取數據。現在,我只是試圖創建對象,使其在與遊戲代碼合併之前顯示爲黑色矩形佔位符。有人有什麼建議從哪裏開始?Android Trading Card遊戲卡對象
這裏是戰場佈局當前代碼:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="@color/blue_default">
<View
android:id="@+id/hand"
android:background="@color/green_default"
android:layout_width="fill_parent"
android:layout_height="70dp"
android:layout_alignParentBottom="true"
/>
<View
android:id="@+id/sidebar"
android:background="@color/gray_default"
android:layout_width="60dp"
android:layout_height="fill_parent"
/>
<View
android:id="@+id/graveyard"
android:background="@color/red_default"
android:layout_width="60dp"
android:layout_height="fill_parent"
android:layout_toRightOf="@id/sidebar"
/>
</RelativeLayout>
下面是它目前的樣子:
這裏是什麼,我想它的外觀的示例像:
對你有好處。你有問題嗎? – Simon 2013-05-13 20:46:18
問題是我該如何去做這樣的對象? – Netsuki 2013-05-13 20:55:07
@Netsuki,如果你不習慣編寫XML佈局,簽出[AbLE](http://phil-brown.github.io/AbLE/) - 它可以讓你使用簡單的帶註釋的java類文件編寫你的佈局,並且您可以管理代碼中的所有點擊連接。 – Phil 2013-05-13 21:18:55