You may try refering to this code
LinearLayout linearLayout = (LinearLayout)findViewById(R.id.info)
...
linearLayout.addView(valueTV);
also make sure that the layout
params you're creating are LinearLayout.LayoutParams...
Or try this code
LinearLayout layout = (LinearLayout) findViewById(R.id.linear);
String[] informations = new String[] { "one", "two", "three" };
TextView informationView;
for (int i = 0; i < informations.length; i++) {
View line = new View(this);
line.setLayoutParams(new LayoutParams(1, LayoutParams.MATCH_PARENT));
line.setBackgroundColor(0xAA345556);
informationView = new TextView(this);
informationView.setText(informations[i]);
layout.addView(informationView, 0);
layout.addView(line, 1);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…