Android: Switch to a table layout instead of just a list layout. The list layout didn't align the columns.

This commit is contained in:
Rom Walton 2013-02-19 00:21:50 -05:00 committed by Oliver Bock
parent dc6aee4dcc
commit b283880427
3 changed files with 29 additions and 21 deletions

View File

@ -22,11 +22,11 @@
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
<TableLayout
android:id="@+id/msgsList"
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_height="wrap_content" >
</ListView>
</TableLayout>
</LinearLayout>

View File

@ -23,25 +23,33 @@
android:layout_height="match_parent"
android:orientation="horizontal" >
<TextView
android:id="@+id/msgs_project"
android:layout_width="wrap_content"
<TableRow
android:id="@+id/msgs_row"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:text="Project" />
android:orientation="horizontal" >
<TextView
android:id="@+id/msgs_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:text="Date" />
<TextView
android:id="@+id/msgs_project"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:text="Project" />
<TextView
android:id="@+id/msgs_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:text="Message" />
<TextView
android:id="@+id/msgs_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:text="Date" />
<TextView
android:id="@+id/msgs_message"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:text="Message" />
</TableRow>
</TableRow>

View File

@ -58,7 +58,7 @@ public class MessagesListAdapter extends ArrayAdapter<Message>{
// Construct output
String project = listItem.project;
String date = new Date(listItem.timestamp/1000).toString();
String date = new Date(listItem.timestamp).toString();
String message = listItem.body;
// Instantiate layout elements