开发者

EditText in loop problem

In my code when I create the EditText boxes I set them to accept numbers only, but this only applies to the first column of the EditText boxes. The following columns then won't accept anything to be entered in them. What is causing this?

My code:

   for(int i = 0; i < MatrixMultiply.h1; i++){
       columnEditTexts = new ArrayList<EditText>();
       TableLayout table = (TableLayout)findViewById(R.id.myTableLayout);
       TableRow row = new TableRow(this);
       EditText column;
       for(int j = 0; j < MatrixMultiply.w1; j++){
           column = new EditText(this);
           column.setInputType(InputType.TYPE_CLASS_NUMBER);
           column.setId(i);
           row.addView(column);
           columnEditTexts.add(column);
       }
       table.addView(row);
       arrayOfEditTexts.add(columnEd开发者_如何学GoitTexts);
   }


I'm wondering if it's okay that you're setting every column in a row to have the same id.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜