Partage
  • Partager sur Facebook
  • Partager sur Twitter

Android 3.0: Probleme urgent

19 janvier 2012 à 18:12:11

Bonjour :)
J'ai mon layout définit en XML, composé comme celui qui suit:
<image>http://www.siteduzero.com/upload-210.html?dir=1&parent_id=7031647&mid_img=343161&textarea=texte</image>

Le But: Quand j'appuie sur le bouton c'est qu'il ajout une ligne avec plusieurs champs de saisie. Comme si on rajoutait une ligne dans tableau avec un nombre de cellules programmés (5 en tout).

Dans une cellule = 1 champ de saisie.

Voila le code en java
public void tableau(){
    	   setContentView(R.layout.tableau);
    	   Button bouton_add_critere = (Button)findViewById(R.id.bouton_critere);
    	   bouton_add_critere.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				TableLayout.LayoutParams table = new  TableLayout.LayoutParams(4,5);
				
			}
		});
       }


... le code XML de mon layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >


    	<TableLayout
    	    xmlns:android="http://schemas.android.com/apk/res/android"
    	    android:layout_width="match_parent"
    	    android:layout_height="wrap_content" >

    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >


        <EditText
            android:id="@+id/nom"
            android:layout_width="180sp"
            android:layout_height="wrap_content"
            android:inputType="textPersonName"
            android:text="@string/Name" >

            <requestFocus />

        </EditText>


        <EditText
            android:id="@+id/prenom"
            android:layout_width="180sp"
            android:layout_height="wrap_content"
            android:inputType="textPersonName"
            android:text="@string/prenom" />



        <EditText
            android:id="@+id/date_naissance"
            android:layout_width="100sp"
            android:layout_height="wrap_content"
            android:inputType="date"
            android:text="@string/Date" />
        

        <EditText
            android:id="@+id/nom_produit"
            android:layout_width="190sp"
            android:layout_height="wrap_content"
            android:inputType="textPersonName"
            android:text="@string/Produit" />


        <EditText
            android:id="@+id/ref_produit"
            android:layout_width="190sp"
            android:layout_height="wrap_content"
            android:inputType="textPersonName"
            android:text="@string/ref_produit" />



        <Button
            android:id="@+id/bouton_critere"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/Ajout_Critere" />

    </TableRow>
    </TableLayout>

</LinearLayout>

Comment y procéder ou à remanier?

Merci d'y répondre le plus rapidement

:)
  • Partager sur Facebook
  • Partager sur Twitter