下面的代碼示例:安卓:當我把「addView(..)一個for循環,我得到error..Here內,我們去
TableLayout ll = (TableLayout)findViewById(R.id.dyn_lyr);
也同樣與LinearLayout中
//LinearLayout ll = (LinearLayout)findViewById(R.id.dyn_lyr);
TextView tv1 = (TextView) findViewById(R.id.testEditText);
tv1.setText("SomeTextGoesHere");
for(int i=1 ; i<= 5 ; i++){
ll.addView(tv1);
}
中的LinearLayout /表格在ScrollView裏面!
什麼是錯誤? – zmbq
感謝您的考慮,您無法多次添加視圖的相同實例 –