xml - Android Trading Card Game card objects -


i'm writing gui android app plays trading card game. have code battlefield layout using several views. need make object represents deck, , object represent card in hand/on battlefield. cards, when long-tapped need bring menu of options (attack, defend, etc), or when double tapped in hand area (green) need move battlefield (blue). i'm not sure kind of xml object can use this, since needs happen dynamically , data back-end code (card name, image). i'm trying create objects appear black rectangle placeholders before incorporated game code. have suggestions start?

here current code battlefield layout:

<?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> 

here looks like:

here example of like:

if going create simpler app plain static stuff arranged in mock, suggest take @ gridview (http://developer.android.com/guide/topics/ui/layout/gridview.html), use component sidebar, hand , graveyard sections. then, have create custom views populate adapters (http://developer.android.com/guide/topics/ui/declaring-layout.html#adapterviews) single cards, card stacks, buttons, etc...

remember deepest view hierarchy goes (the more cards show , stack on respective gridviews), more memory app use , android close app if available memory eaten.

imho, if going create game, , because these days games must have nice , fluid ui 2d or 3d graphics, should take advantage of android's opengl support (http://developer.android.com/guide/topics/graphics/opengl.html), , create memory efficient objects handle game's logic.

good luck!


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -