TableLayout-Detail

XML-Code für das TableLayout

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent" >

 <TableRow>
 
 <TextView
 android:layout_column="1"
 android:gravity="center"
 android:minWidth="50dip"
 android:text="Place"
 android:padding="2dip" />
 
 <TextView
 android:layout_column="2"
 android:minWidth="140dip"
 android:text="Team"
 android:padding="2dip" />
 
 <TextView
 android:layout_column="3"
 android:gravity="center"
 android:minWidth="50dip"
 android:text="Win/Lose"
 android:padding="2dip" />
 
 <TextView
 android:layout_column="4"
 android:gravity="center"
 android:minWidth="50dip"
 android:text="Points"
 android:padding="2dip" />
 
 </TableRow>

 <View
 android:layout_height="2dip"
 android:background="#CCFFFFFF" />
 
 <TableRow>
 
 <TextView
 android:layout_column="1"
 android:gravity="center"
 android:text="1"
 android:padding="2dip" />
 
 <TextView
 android:layout_column="2"
 android:text="1st Team Name"
 android:padding="2dip" />
 
 <TextView
 android:layout_column="3"
 android:gravity="center"
 android:text="4 / 2"
 android:padding="2dip" />
 
 <TextView
 android:layout_column="4"
 android:gravity="center"
 android:text="8"
 android:padding="2dip" />
 
 </TableRow>
 
</TableLayout>

Erklärung der verschiedenen Komponenten:


android:layout_width Die Breite der Komponente.
android:layout_height Die Höhe der Komponente.
android:layout_column Die Angabe der entsprechenden Spalte.
android:gravity Bestimmt die Ausrichtung der Komponente.
android:layout_minWidth Angabe einer Mindestbreite einer Komponente.
android:text Der Text, den das Textfeld enthält.
android:padding
Angabe eines Abstands rund um die Komponente.

 

In der Main-Klasse sollte folgendes stehen:

import android.app.Activity;
import android.os.Bundle;

public class Main extends Activity {
 /** Called when the activity is first created. */
 @Override
 public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.main);
 }
}

Kommentare
Suche
Nur registrierte Benutzer können Kommentare schreiben!

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

The secret of any online business is web hosting. Select the best hosting service reading offered by justhost.
Free Joomla Templates designed by Joomla Hosting