tags:

views:

508

answers:

2

I use table layout for for display data as table .But i want table with userdefined columns and rows with borders.Give me suggestions?

+1  A: 

The Android developer site contains great documentation. You can find information on table layouts here. The easiest way to learn is of course to pick-up a good book on Android and experiment.

Maurits Rijk
But in those books didn't specify the concept is " table with borders"in table layout
sairam
This was a terrible answer - I can't believe it got two votes. This answer could have been pasted into any Android question on Stackoverflow and it is equally useless. I was able to find a good answer here: http://stackoverflow.com/questions/2387033/android-table-round-border
Brad Hein
Another Great example: http://stackoverflow.com/questions/1276346/help-in-using-shape-drawable-as-my-background-xml
Brad Hein
A: 

I have to agree with Brad. That was an awful answer. The Android documentation states that TableLayout containers do not display border lines, so sending them to the Android site wont help them a bit. I was able to find a "dirty" solution on droidnova, which involves setting a background color for the TableLayout, then setting a different background color for the TableRow and adding layout_margin to the row. I'm not fond of this solution, but it does work for row borders. I guess you could do the same thing with the items composing each "cell" item but I haven't verified.

An example similar to the one on DroidNova:

<TableLayout android:background="#000000"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
  <TableRow android:background="#FFFFFF"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:layout_margin="1dp">
     ...
  </TableRow>
</TableLayout>

The original post is at http://www.droidnova.com/display-borders-in-tablelayout,112.html

Shawn Yale