Hacer TextView Scrollable en Android mediante programación

Quiero hacer textView programaticamente y hacerlos desplazables. Estoy llamando a este método una y otra vez para obtener textView y añadirlo a la linearLayout .

 TextView textView = addTextView(contents.paragraphs.get(i),false); linearLayout.addView(textView); 

Pero, no es desplazable en absoluto. El método es:

 private TextView addTextView(String text,boolean type) { TextView valueTV = new TextView(this); valueTV.setText(text); valueTV.setTextColor(getResources().getColor(R.color.colorTextPrimary)); valueTV.setLayoutParams(new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); valueTV.setMaxLines(1000); valueTV.setVerticalScrollBarEnabled(true); valueTV.setMovementMethod(new ScrollingMovementMethod()); return valueTV; } 

Cambiar a:

 valueTV.setLayoutParams(new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT)); 

Si utiliza WRAP_CONTENT el TextView aumentará la altura 'indefinidamente'.

  • Disposición de Android - peso de diseño y weightsum
  • Android SpannableString establecer fondo detrás de parte del texto
  • Configuración de textview en la parte inferior de android
  • ¿Cómo puedo agregar efecto de degradado al color de fondo de TextView en un ListView?
  • Multiline TextView con la anchura "wrap_content"
  • ¿Qué es android: includeFontPadding?
  • TextView no se ajusta a la pantalla
  • Cambio de tipo de texto justificado
  • Volver a establecer una altura de TextView mediante programación
  • Cómo procesar textview para HTML y Linkify
  • Android TextView Problema de enfoque en listview (sólo MarshMallow)
  • FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.