Androidで動的テーブル(行と列のカスタム数)を作成したいと思います。最小SDKは3.0です
私は2つの方法のいずれかを介してそれをクレートすると思います:
1)新しいTextViewを作成する
TableRow tr = ....;
for ( i = 0; i < NumOfRows .... ) {
TextView tv = new TextView(this);
tv.setLayoutParams(...);
tv.setText("Text I wanna to see");
tr.add(tv);
}
2)インフレータ経由
LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
for ( i = 0; i < NumOfRows .... ) {
TextView tv = (TextView) mInflater.inflate(R.layout.my_cell_layout, null, false)
.findViewById(R.id.my_cell_item);
tv.setText("Text I wanna to see");
tr.add(tv);
}
3)あなたのやり方:)
何が速いですか?何を選べばいいですか?enter code here