我有包含复选框和 2 个文本视图的行
我正在使用此代码重复自定义 xml 布局,它工作正常
但我想知道我的意思是行中每个组件的每个 id(复选框的 id 和编辑 1 和 id 编辑 2)
所以我可以和他们一起工作。
我还需要 for 循环来为 ids 创建这个实例。
为了让我的 Q 清楚,我想要如下:
for ( int i = 0 ; i < 60 ; i++ ){
CheckBox "auto name here " = new (CheckBox) findViewById(R.id."the id of the current item in rep.xml layout or row ");
"auto name here".setChecked(true);
等等……
我在 for 循环中创建行的代码:
for (int i = 0; i<60 ; i++ ){
LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = (View) inflater.inflate(R.layout.rep, null);
tl.addView(view); // tl is table-layout instance
}