如何处理在Android的布局Ascii码 [英] How to handle Ascii character in Android Layout

查看:249
本文介绍了如何处理在Android的布局Ascii码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

相关<一个href=\"http://stackoverflow.com/questions/33214391/how-to-show-special-character-in-android-layout\">Question

我必须表现出的TextView 不同的 ASCII 字符。性格是:

 ('·')(\\\\ /)(°,,,°)(\\\\ /)(⚆_⚆)

如果我在上面的屏幕字符显示和使用。我懂了:

但是,当你看第一个字符。它显示了错误的图像。它应该是这样的:

在这里输入的形象描述

我从来没有工作过的 Ascii码这样。

问题

我该如何处理这些类型的情况呢?是否有任何图书馆的存在?

任何帮助将是AP preciable。

编辑 - 1

布局文件

布局文件是 GridView控件

 &LT;?XML版本=1.0编码=UTF-8&GT?;
&LT; LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
 机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:背景=@机器人:彩色/白
机器人:方向=垂直&GT;
&LT;的TextView
    机器人:ID =@ + ID / img_name
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =WRAP_CONTENT
    机器人:比重=中心
    机器人:填充=8DP
    机器人:TEXTSIZE =30dp/&GT;&LT; / LinearLayout中&GT;


解决方案

我觉得你只需要使用换行符( \\ n )。

 &LT;的TextView
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =WRAP_CONTENT
    机器人:文本=(\\\\ /)\\ n(°,,,°)\\ N(\\\\ /)
    机器人:比重=中心/&GT;

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>

解决方案

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" />

这篇关于如何处理在Android的布局Ascii码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆