For who are just searching for a GridView type actually to be more specific dynamic GridView type example in android I will show you how to do it by drawing a Canvas and put it with awesome look and feel. Here is the code:
public class CustomeTblLayout extends TextView{ public CustomeTblLayout(Context context, AttributeSet attrs) { super(context, attrs); } @Override public void onDraw(Canvas canvas){ canvas.drawColor(Color.WHITE); Paint mLinePaint = new Paint(); Paint mMarginPaint = new Paint(); canvas.drawLine(0, getMeasuredHeight(), getMeasuredWidth(), getMeasuredHeight(), mLinePaint); canvas.drawLine(15, 0, 15, getMeasuredHeight(), mMarginPaint); canvas.save(); canvas.translate(20, 10); super.onDraw(canvas); canvas.restore(); } }Now For the XML Layout you need to add the following:
And then create an XML to show the Custom TextView you have just created:
And write the Main Activity:
Add The Activity Class for the Main XML:
public class TestingActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ListView appointmentHistory = (ListView) findViewById(R.id.chu); ArrayList< Map< String,String > > appntmntHistoryList = new ArrayList< MapAfter that, you can see a Dynamic Android Grid Border.>(); Map mpStr = new HashMap < String, String >(); mpStr.put("date", "20/10/08"); mpStr.put("amount", "200"); appntmntHistoryList.add(mpStr); mpStr = new HashMap < String, String >(); mpStr.put("date", "12/05/11"); mpStr.put("amount", "45"); appntmntHistoryList.add(mpStr); SimpleAdapter adapter = new SimpleAdapter(this,appntmntHistoryList,R.layout.list_items,new String[] {"date","amount"},new int[] {R.id.customId,R.id.customId2}); appointmentHistory.setAdapter(adapter); } }