gpt4 book ai didi

java - Android Studio 无法使用其他语言(英语除外)

转载 作者:行者123 更新时间:2023-12-02 01:57:00 25 4
gpt4 key购买 nike

我想在我的 Android 应用程序中以另一种语言发出警报消息。但这些文本不会出现在 Android studio 中。它们显示为一些未知的字符类型,如图 in this image 所示。

我该如何解决这个问题?

最佳答案

虽然这并不能真正回答你的问题,

我建议不要使用硬编码字符串,而是使用Android资源系统来支持多种语言,

例如:

英语字符串(默认区域设置),/values/strings.xml:

<resources>
<string name="hello_world">Hello World!</string>
</resources>

西类牙语字符串(区域设置),/values-es/strings.xml:

<resources>
<string name="hello_world">¡Hola Mundo!</string>
</resources>

然后像这样使用语言资源:

showMessage(getString(R.string.error_title), getString(R.string.hello_world));

关于java - Android Studio 无法使用其他语言(英语除外),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52183531/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com