I have seen examples of ListView where each row has multiple view objects, like a TextView and a Button or 2 TextViews, etc. I want to have 3 TextView objects per row, and a vertical border between them, and 4 such rows, so that the ListView resembles a 3 by 4 grid with cell borders. Is it possible?
I need 2 solutions: one, using a ListView with borders as described above; two, using any other appropriate layout or viewgroup like GridView or TableLayout.
Please give sample code.
Thanks.
In Android a ListView can use custom xml to define each row.
A simple example of a custom row from an array would be just
setListAdapter(new ArrayAdapter<String>(this, R.layout.list_row_xml, sourceArray));wherelist_row_xml.xmldefines how each row looks.There is a tutorial
here which shows you how to use more advanced custom rows. Specifically you’re looking for his
row.xmlcode.Hope that helps