0
// customize linear layout
LinearLayout mainLayout = new LinearLayout(this);
LinearLayout originWordsLayout = new LinearLayout(this);
LinearLayout transWordsLayout = new LinearLayout(this);
mainLayout.setOrientation(LinearLayout.HORIZONTAL);
originWordsLayout.setOrientation(LinearLayout.VERTICAL);
transWordsLayout.setOrientation(LinearLayout.VERTICAL);
// set col 1
TextView originTitle = new TextView(this);
originTitle.setWidth(android.view.ViewGroup.LayoutParams.MATCH_PARENT);
originTitle.setHeight(android.view.ViewGroup.LayoutParams.MATCH_PARENT);
originTitle.setText("col1");
originWordsLayout.addView(originTitle);
// set col 2
TextView transTitle = new TextView(this);
transTitle.setWidth(android.view.ViewGroup.LayoutParams.MATCH_PARENT);
transTitle.setHeight(android.view.ViewGroup.LayoutParams.MATCH_PARENT);
transTitle.setText("col2");
transWordsLayout.addView(transTitle);
mainLayout.addView(originWordsLayout);
mainLayout.addView(transWordsLayout);
setContentView(mainLayout);
當我運行我的應用程序時,屏幕上沒有任何東西 任何人都告訴我我的代碼有什麼問題? 什麼我想要做的就是動態地添加一些瀏覽到我的佈局爲什麼下面的android代碼不顯示