0
私はxmlでテーブルレイアウトを作成しました。実行時に、私は最初のケースで私はテーブルのレイアウトを塗りつぶしている条件を使用しています。しかし、2番目のケースでは、同じレイアウトにコンテンツを追加しています。そして、彼らはレイアウトの最後に追加されます。しかし、私はレイアウトの以前の内容をクリアする必要があります。 私はこれらのremoveallview()メソッドを使用することができ、それが動作しません。..テーブルレイアウトの以前の内容を消去する方法は?
ll=(LinearLayout)findViewById(R.id.linear1);
for (int i = 0; i <= 1; i++) {
table=new TableLayout(mContext);
TableLayout.LayoutParams tableParams= new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT,TableLayout.LayoutParams.WRAP_CONTENT);
int leftMargin=0;
int topMargin=0;
int rightMargin=0;
int bottomMargin=0;
tableParams.setMargins(leftMargin, topMargin, rightMargin, bottomMargin);
table.setLayoutParams(tableParams);
lf_header = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
header_view = lf_header.inflate(R.layout.header, null);
DBAdapter dbAdapter=DBAdapter.getDBAdapterInstance(this);
try {
dbAdapter.createDataBase();
} catch (IOException e) {
Log.i("*** select ",e.getMessage());
}
dbAdapter.openDataBase();
if(i==0){
((TextView) header_view.findViewById(R.id.header_txt1)).setText("Over Due");
header_view.setBackgroundColor(Color.RED);
table.addView(header_view);
ll.addView(table);
任意の提案は、のように私のコード?
のコード例では、 "ALL" ボタン私は別のボタンをクリックしてくださいよ、このテーブルのレイアウトcreated.afterをクリックしたときに
を試してみてください..事前に
感謝に感謝しているし、もう一度、 "ALL" button.pleをクリックして、table.removeAllViewsInLayout()をどこで削除するかwhrを使用するかを提案します。 – Selva
削除する必要がある場合は、それを – Rasel
と呼んでください。それは明確なテーブル – Selva