简体   繁体   English

如何在Android TextView中实现此目的?

[英]How can I achieve this in Android TextView?

I am displaying some numbers in android textview, I want to make the look of the numbers like the pictures shown below. 我在android textview中显示一些数字,我想使数字看起来像下面所示的图片。 Is there a way to add background image for every character in the textview or is there some other way to achieve this? 有没有一种方法可以为textview中的每个字符添加背景图像,或者有其他方法可以实现此目的?

I searched for answers on google and SO but no luck. 我在Google和SO上搜索了答案,但没有运气。 Any help would be appreciated. 任何帮助,将不胜感激。

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:text="1234567890"
    android:textSize="50sp"
    android:id="@+id/tvTotal"
    android:layout_alignTop="@+id/textView6"
    android:layout_toRightOf="@+id/textView6"
    android:layout_toEndOf="@+id/textView6" />

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

Download a font like this and tell the textview to use it. 下载这样的字体,并告诉textview使用它。 http://www.dreamstime.com/royalty-free-stock-images-flip-board-letters-numbers-image21493569 http://www.dreamstime.com/royalty-free-stock-images-flip-board-letters-numbers-image21493569

Typeface type = Typeface.createFromAsset(getAssets(),"fonts/my_font.ttf"); 
tvTotal.setTypeface(type);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM