我嘗試學習如何在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