我尝试将我的应用程序翻译成其他语言。我向项目添加了一些本地文件值/ strings.xml以及相关的翻译。该文本现已翻译,但这还不够。有两个问题:
我如何解决这些问题?
答案 0 :(得分:1)
您可以为从右到左的语言定义其他布局。您应该将其放置在layout-<您的语言代码>。
如果字符串太大,你也可以截断并替换字符串的最后一个字符。 你可以使用android:ellipsize和android:singleLine属性:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/text_mytext"
android:ellipsize="end"
android:singleLine="true"
/>
另一种方法是在dimens.xml中为所需语言定义文本大小,并按如下方式使用它:
在dimens.xml中:
<dimen name="text_size">32sp</dimen>
布局:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/text_mytext"
android:textSize="@dimen/text_size"
/>