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);
}
tengo que hacer algo por el estilo .. por lo que sería mostrar comoCrear una nueva programación TextView luego desplegarla por debajo de otro TextView
one
two
asdfasdfsomething
en la pantalla ..
En pocas palabras, lo que está mal con su código? ¿Qué no funciona? Por cierto, si esto es una actividad, simplemente use 'this' en lugar de' getApplicationContext() '. – EboMike
el título de su pregunta dice "mostrarlo _abajo_ otra vista de texto", pero su pregunta establece de manera diferente, con todos los textos en una fila; aclare o formatee el texto de la pregunta en consecuencia. –
La pregunta no estaba formateada correctamente - Lo arreglé. (Probablemente no sea intuitivo que las líneas nuevas se traguen) – EboMike