Why the android code below display nothing -
// 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); and when run app, there's nothing on screen tell me what's wrong code? want dynamically add view layout
originwordslayout , transwordslayout should wrap_content , textview transtitle , textview origintitle instead of match_parent
Comments
Post a Comment