我尝试学习如何在android studio中编程,我目前正在第二篇教程中介绍如何通过本地化来更改语言。 当我尝试在文件夹values_el
内创建第二个strings.xml
文件时,它说我不能让名称应该是唯一的。 我尝试将原始的strings.xml
文件从值文件夹复制到新的values_el文件夹,我翻译了这些消息但没有任何反应。 另外我尝试右键点击原始strings.xml
文件,我按翻译选项,我从那里翻译他们,但没有再发生。 当我在手机上运行应用程序时,语言在上述两种方式中都是英语。 我的手机语言是希腊语,但我的程序字母是英语。在Android应用程序中添加新区域并强制区域设置(本地化)
问题2.
首先,为什么语言没有我的电话改变? 第二是有没有办法通过按下按钮来改变我的应用程序的语言,而我打开它?我在谷歌播放的一些游戏可以选择在开始游戏之前选择你的语言。 对不起,我的英语,如果你不明白我说的话请让我知道,所以我尝试用谷歌翻译帮助更好地解释它。 无论如何感谢您的时间。
那是我的代码运行
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_my"
android:orientation="horizontal">
<EditText
android:id="@+id/edit_message"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/edit_message" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_send"
android:onClick="sendMessage"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/test"
android:onClick="testActivity" />
</LinearLayout>
这样也可以用希腊国旗创建文件strings.xml而不做任何事情。谢谢。 – Mixalis