How to handle Ascii character in Android Layout

心不动则不痛 提交于 2019-12-24 05:56:44

问题


Related Question

I do have to show different Ascii character in TextView. Character are:

( `·´ )

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

( ⚆ _ ⚆ )

If I used above character and display on screen. I got this:

But when you look at the first character. It's displaying the wrong image. It supposed to be like this:

I have never worked on Ascii character like this.

Question

How can I handle these type of situations? Is there any libraries exist?

Any help would be appreciable.

Edit-1

layout file

Layout file is a 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>

回答1:


I think you just have to use newlines (\n).

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


来源:https://stackoverflow.com/questions/33217609/how-to-handle-ascii-character-in-android-layout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!