博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Android用省略号替换“...”
阅读量:2289 次
发布时间:2019-05-09

本文共 2652 字,大约阅读时间需要 8 分钟。

本文翻译自:

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

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

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

at this line 在这条线上

Searching...

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

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


#1楼

参考:


#2楼

To make thing short just put … 为了简单…只需将… in place ... 到位 ...

  • 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

转载地址:http://bwjnb.baihongyu.com/

你可能感兴趣的文章