-2

同じレイアウトでトグルボタンがクリックされたときに実行時にレイアウトにテキストビューを追加する方法???

4

2 に答える 2

2

Here you have an example:

(On button Click)

LinearLayout linearLayout = (LinearLayout) findViewById(R.id.mylayout)
TextView txt1 = new TextView(MyClass.this);
linearLayout.setBackgroundColor(Color.TRANSPARENT);
linearLayout.addView(txt1);
于 2012-11-22T08:40:27.583 に答える
0

Probably would be easier to just show/hide it. Use setVisibility(value), value could be View.GONE, View.INVISIBLE or View.VISIBLE.

于 2012-11-22T08:40:49.483 に答える