Как добавить TextView в LinearLayout динамически в Android?

Я пытаюсь добавить TextView в LinearLayout динамически, как в следующем коде, но он не появляется, когда я запускаю приложение?

setContentView(R.layout.advanced);

m_vwJokeLayout=(LinearLayout) this.findViewById(R.id.m_vwJokeLayout);
m_vwJokeEditText=(EditText) this.findViewById(R.id.m_vwJokeEditText);
m_vwJokeButton=(Button) this.findViewById(R.id.m_vwJokeButton);

TextView tv=new TextView(this);
tv.setText("test");
this.m_vwJokeLayout.addView(tv);

В чем проблема?

59
задан Adham 21 May 2018 в 19:47
поделиться