¿Hay alguna manera de que aparezca texto delimitado en TextView?Android: ¿cómo aparecer el texto delimitado en TextView?
5
A
Respuesta
16
sugeriría para extender TextView
Ver Android Custom Component Guide
package samples.test;
public class MyTextView extends TextView {
public MyTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public MyTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MyTextView(Context context) {
super(context);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
Rect rect = new Rect();
Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setColor(Color.WHITE);
paint.setStrokeWidth(3);
getLocalVisibleRect(rect);
canvas.drawRect(rect, paint);
}
}
que el uso en xml diseño:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<samples.test.MyTextView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="@string/hello" />
</LinearLayout>
5
La manera más sencilla es utilizar un fondo 9 parche.
<TextView android:id="@+id/txt_target"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="000000000"
android:gravity="center_vertical"
android:background="@drawable/textfield_default"
android:layout_marginRight="5dip" />
Cuestiones relacionadas
- 1. cómo ajustar texto en textview en android
- 2. Justificar texto en TextView Android
- 3. cómo cambiar texto en Android TextView
- 4. ¿Cómo alinear el texto dentro de TextView en Android?
- 5. Cómo ajustar el interletraje de texto en Android TextView?
- 6. cómo obtener texto de autocompletar textview android
- 7. Android TextView El texto no se ajusta
- 8. Android: texto de desplazamiento automático en TextView
- 9. Copiar texto de TextView en Android
- 10. Android: texto dinámico subrayado estáticamente en TextView
- 11. Linkify en android TextView
- 12. Ajustar el fondo al texto en TextView en android
- 13. Android TextView y conseguir línea de texto
- 14. Android TextView
- 15. cómo agregar borde a un texto en textview android
- 16. Android TextView y texto que envuelve
- 17. Cómo obtener el texto ellipsized en una TextView
- 18. Android TextView Wrap
- 19. ¿Cómo configurar el texto de TextView?
- 20. Android TextView setTextSize aumenta incorrectamente el tamaño del texto
- 21. TextView android: Cambiar el color del texto al hacer clic
- 22. Escape "" en Texto en TextView
- 23. El texto de Android TextView no se centrará
- 24. Android: Linkify TextView
- 25. multicolor Android en una TextView
- 26. Convertir matriz en texto delimitado por comas
- 27. ¿Cómo hacer textView redondeado en Android?
- 28. ¿Cómo anexar una Cadena a un TextView de Android?
- 29. ¿Cómo alinear el texto a la parte superior de TextView?
- 30. ¿Cómo insertar texto "<<" en TextView?
¿Podría aclarar a qué se refiere con "texto delimitado"? –
Gracias, respuesta. Quiero decir que cada letra del texto estaría rodeada. Como hacerlo ? Lo siento por mi mal inglés. – AndroiDBeginner