Create a new TextView programmatically then display it below another TextView
问题 String[] textArray={"one","two","asdasasdf asdf dsdaa"}; int length=textArray.length; RelativeLayout layout = new RelativeLayout(this); RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); for(int i=0;i<length;i++){ TextView tv=new TextView(getApplicationContext()); tv.setText(textArray[i]); relativeParams.addRule(RelativeLayout.BELOW, tv.getId()); layout.addView(tv, relativeParams); } I need to do something like