Wählen Sie ein Tabellenzeilen innerhalb einer TableLayout Dynamisch

Ich bin momentan dabei, ein Tablelayout mit vielen TableRows dynamisch, zum Beispiel:

for(int i = 0; i<cont; i++)
                { 
                     id[i] = customers[i].CustomerNumber;

                     //Create a new row to be added.
                     tr = new TableRow(this);

                     //Create text views to be added to the row.
                     tv = new TextView(this);

                     //Put the data into the text view by passing it to a user defined function createView()
                     createView(tr, tv, id[i].ToString());


                     //Add the new row to our tableLayout tl
                     tl.AddView(tr);
                }    

- Und dies ist der createView-code:

private void createView(TableRow tr, TextView t, String viewdata) {

        t.SetText(viewdata, TextView.BufferType.Editable);

       //adjust the porperties of the textView

       //t.SetLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));

        //You have to use Android.Graphics.Color not System.ConsoleColor;
        t.SetTextColor(Color.Blue);
        t.SetBackgroundColor(Color.Cyan); 
        t.SetPadding(5, 0, 0, 0);

        tr.SetPadding(0, 1, 0, 1); 
        tr.SetBackgroundColor(Color.Black); 

        tr.AddView(t); //add TextView to row.

   }

Mein Problem ist, dass ich wollen, wählen Sie aus dem TableLayout, das alles enthält, in einer einzigen Zeile, um in der Lage zu wählen und zu reagieren, ein click-Ereignis, um es zu verwenden für weitere Zwecke.

InformationsquelleAutor arkmetal | 2012-07-05
Schreibe einen Kommentar