如何在带有 React Native Text 的 Android 中实现软连字符 [英] How to implement soft hyphen in Android w/ React Native Text

查看:36
本文介绍了如何在带有 React Native Text 的 Android 中实现软连字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<Text>
Aufmerksamkeits{'\u00AD'}defizit
</Text>

这导致在 iOS 上

Aufmerksamkeits-
赤字

Aufmerksamkeits-
defizit

但在 Android 上

But on Android to

Aufmerksamkeitsd
效率

Aufmerksamkeitsd
efizit

因此,Android 似乎忽略了给定的软连字符.我怎样才能在 Android 上也能正常工作?

So it seems that Android ignores the given soft hyphen. How can I make this work on Android as well?

谢谢!

推荐答案

我现在有点晚了,但我花在这上面的时间比我引以为豪的要多.如果要使用软连字符,请在字符串中使用 \u00AD,例如:

I now it is a bit late, but I spent more time on this than I am proud of. If you want to use soft hyphen use \u00AD in strings, e.g.:

Einzelfahrrad\u00ADkarte

为了使其正常工作,在您的 TextView 中,您必须添加:

In order to make this working though, in your TextView, you have to add:

android:hyphenationFrequency="full"

这篇关于如何在带有 React Native Text 的 Android 中实现软连字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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