小编Mix*_*lis的帖子

添加新的语言环境并在Android应用程序中强制使用语言环境(本地化)

我尝试学习如何在android studio中编程,我目前正在第二篇关于如何通过本地化来改变语言的教程.当我尝试strings.xml在文件夹中创建第二个文件时,values_el它说我不能因为名称应该是唯一的.我尝试将原始strings.xml文件从values文件夹复制到新的values_el文件夹,我翻译邮件但没有任何反应.此外,我尝试右键单击原始strings.xml文件,我按下翻译选项,我从那里翻译,但没有任何反复.当我在手机中运行应用程序时,我尝试上述两种方式的语言都是英语.我的手机语言是希腊语,但我的程序字母是英文.

问题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>
Run Code Online (Sandbox Code Playgroud)

android localization android-studio

6
推荐指数
1
解决办法
5603
查看次数

标签 统计

android ×1

android-studio ×1

localization ×1