java - 如何在 Android 布局中处理 Ascii 字符

标签 java android ascii ascii-art

相关Question

我必须在 TextView 中显示不同的 Ascii 字符。字符是:

( `·´ )

(\\/)(°,,,°)(\\/)

( ⚆ _ ⚆ )

如果我使用上面的字符并显示在屏幕上。我懂了: enter image description here

但是当您查看第一个字符 时。它显示错误的图像。它应该是这样的:

enter image description here

我从来没有像这样处理过 Ascii 字符

问题

我该如何处理这些类型的情况?有图书馆吗?

任何帮助都将不胜感激。

编辑-1

布局文件

布局文件是一个GridView

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:orientation="vertical">
<TextView
    android:id="@+id/img_name"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:padding="8dp"
    android:textSize="30dp" />

</LinearLayout>

最佳答案

我认为您只需要使用换行符 (\n)。

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="(\\/)\n(°,,,°)\n(\\/)"
    android:gravity="center" />

关于java - 如何在 Android 布局中处理 Ascii 字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33217609/

相关文章:

更改 ASCII 字符 - 类型无效?

python - 在 Python 中,如何将 8 位二进制数转换为 ASCII 字符?

java - 为什么我从 Spring 存储库中收到 NonUniqueResultException?

java - 字符串文字与字符串对象哈希码

java - 从 Java 中的哈希表替换字符串中的值

java - 如何将布局作为函数参数传递

Java Android :Add array 15times in one second How?

java - Atmosphere - 在 AtmosphereResource 上存储属性

android - android中的动画

html - 如何通过 HTML 代码编写双引号