android - TextView编程中如何设置撇号

标签 android android-layout textview

TextView.setText(String with ') ,我想为 TextView 设置一个文本,但是如果它有空格或撇号,这个文本就会一直未完成 我试过用

String SomeString="MacDonald's";

 SomeString="Fast Food";

我尝试了以下

 HTML.Fromhtml(SomeString).tostring()

 SomeString.replace("'","\\\'") 

但没有什么好结果 结果总是

MacDon 
Fast

有什么好主意吗?!

最佳答案

确保你的撇号是 ' 而不是像

这样的特殊撇号

关于android - TextView编程中如何设置撇号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13029807/

相关文章:

android - RenderScript 未正确渲染 ScriptIntrinsicBlur,导致 ScriptIntrinsicBlur 渲染彩虹色

java - fragment 事务空指针

android:singleLine 的 TextView 不再在 "Deprecated"中?

android - kotlin 中的依赖项不适用于 groovy 文件

android - 如何正确使用Realm

android - RelativeLayout 项目在编辑器和设备上的不同位置

Android 拉伸(stretch) ImageView 以填充宽度,保持宽高比,对齐顶部

Android 模拟器视觉效果看起来很大(异常)

java - 突出显示 TextView 中可能包含 HTML 标签的文本

android - TextView autoSizeTextType 未在 xml 中检测到