Android用省略号替换“...”

本文翻译自:Android Replace “…” with ellipsis character

Since AVD tools 16 I'm getting this warning: 自AVD工具16以来我收到此警告:

Replace "..." with ellipsis character (..., …) ?

in my strings.xml 在我的strings.xml中

at this line 在这条线上

 <string name="searching">Searching...</string>

How do I replace ... ? 我该如何更换... Is it just literally &#8230; 它只是字面上的&#8230; ?

Could someone explain this encoding? 有人可以解释这种编码吗?


#1楼

参考:https://stackoom.com/question/ZohT/Android用省略号替换


#2楼

To make thing short just put &#x2026; 为了简单&#x2026;只需将&#x2026; in place ... 到位 ...

Link to XML character Entities List 链接到XML字符实体列表

  • Look at Unicode column of HTML for row named hellip 查看名为hellip的行的HTML的Unicode列

#3楼

The solution to your problem is: 您的问题的解决方案是:

Go to Window -> Preferences -> Android -> Lint Error Checking

And search for " ellipsis ". 并搜索“ 省略号 ”。 Change the warning level to " Info " or " Ignore ". 将警告级别更改为“ 信息 ”或“ 忽略 ”。


#4楼

If you're using Eclipse then you can always do the following: 如果您正在使用Eclipse,那么您始终可以执行以下操作:

  • Right click on the warning 右键单击警告
  • Select "Quick Fix" (shortcut is Ctrl + 1 by default) 选择“快速修复”(默认情况下快捷键为Ctrl + 1
  • Select "Replace with suggested characters" 选择“替换为建议的字符”

This should replace your three dots with the proper Unicode character for ellipsis. 这应该用省略号的正确Unicode字符替换你的三个点。

Just a note: The latest version of ADT (21.1) sometimes won't do the replace operation properly, but earlier versions had no problem doing this. 请注意:最新版本的ADT(21.1)有时不能正确执行替换操作,但早期版本没有问题。

This is the character: 这是角色:


#5楼

This answer is indirectly related to this question: 这个答案与这个问题间接相关:

In my case textView1.setTextView("done&#8230"); 在我的例子中textView1.setTextView("done&#8230"); was showing some box/chinese character. 显示了一些盒子/汉字。 Later, I checked into fileformat.info for what the value represents and I found this is a Han character. 后来,我检查了fileformat.info中的值代表什么,我发现这是一个汉字。 So, what to do? 那么该怎么办? I searched for "fileformat.info ellipse character" and then everything became clear to me once I saw its values are; 我搜索了“fileformat.info ellipse character”,一旦我看到它的值,一切都变得清晰了;

UTF-16 (hex) 0x2026 (2026)

UTF-16 (decimal) 8,230

So, you have several encoding available to represent a character (eg 10 in Decimal is represented as A in hexa) so it is very important to know when you are writing an unicode character, how receiving function decodes it. 因此,您可以使用多种编码来表示字符(例如,十进制中的10表示为六进制中的A),因此了解何时编写unicode字符,接收函数如何对其进行解码非常重要。 If it decodes as decimal value then you have to provide decimal value, if it accept hexadecimal then you have to provide hexadecimal. 如果它解码为十进制值,那么你必须提供十进制值,如果它接受十六进制,那么你必须提供十六进制。

In my case, setTextView() function accepts decimal encoded value but I was providing hexadecimal values so I was getting wrong character. 在我的例子中,setTextView()函数接受十进制编码值,但我提供了十六进制值,所以我得到了错误的字符。


#6楼

Android Studio中的快速修复快捷方式默认为Alt + Enter

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值