Justificar texto en TextView Android
¿Cómo obtiene textview para ser justificado? ¿Es posible obtener la solución? He buscado la mayoría de los foros, pero no lo inventé. Por favor, ayúdame.
- Dos elementos XML con id id
- Clickable TextView en Android
- Html.fromHtml () está obsoleto, ¿cuál es la alternativa?
- Cómo establecer dinámicamente altura de texto altura android
- Calcular el tamaño del texto según el ancho del área de texto
- Grados (como en Grados Celsius / Fahrenheit) en un TextView
- Utilizar programaticamente setTextSize en? Attr / textAppearanceLarge
- Obtener texto seleccionado de TextView
- Necesita hacer que TextView se desplace verticalmente automáticamente
- ¿Cómo cambio el valor TextView dentro del código Java?
- Android dibujar círculo alrededor de texto
- Ocultar TextView después de algún tiempo en Android
- Android: ClickableSpan en TextView seleccionable
Android no es compatible con la justificación del texto, lo siento. Puedes usar el atributo android:gravity
para alinear el texto a izquierda o derecha o centro, etc., pero no puedes justificarlo. La única opción que supongo es utilizar un WebView
para mostrar el texto y luego utilizar CSS para obtener el texto justificado.
ACTUALIZADO
Hemos creado una clase simple para esto. Hay actualmente dos métodos para lograr lo que usted está buscando. Ambos NO requieren WEBVIEW y APOYAN SPANNABLES .
LIBRARY : https://github.com/bluejamesbond/TextJustify-Android
APLICACIONES : Android 2.0 a 5.X
PREPARAR
// Please visit Github for latest setup instructions.
CAPTURA DE PANTALLA
<RelativeLayout android:id="@+id/RelativeLayout01" android:layout_height="wrap_content" android:layout_width="fill_parent"> <TextView android:id="@+id/TextView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="I'm TextView- Left" android:layout_alignParentLeft="true"> </TextView> <TextView android:id="@+id/TextView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="I'm TextView- Right" android:layout_alignParentRight="true"> </TextView> </RelativeLayout>
Captura de pantalla:
Espero que esto ayude. Si tiene alguna dificultad escriba de nuevo.- Gracias