快速更改Android系统语言 [英] quickly change Android system language

查看:83
本文介绍了快速更改Android系统语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究普通话,并且想要比默认系统设置更快地在英语/普通话(或英语/普通话/葡萄牙语/西班牙语)之间更改Android智能手机(Sony Xperia)的语言.这样,我必须输入设置,滚动到它的中间(这比在列表的开头或结尾要慢),然后单击语言".输入,单击语言,必须一直向下滚动到中文(在最近使用的语言"中,它应该已经在顶部,但是只有我的母语一直在),单击中文,最后单击确定.

我想将这6次以上的点击减少到快速设置区域中的单个按钮上(还有4个图标的空间):当手机使用某种语言时,点击该图标将切换为下一种语言,按住该图标将打开一个菜单,用于添加/删除语言/更改订单/等.

我是Android开发的新手,所以我不知道应用程序是否有可能更改系统语言(需要root特权?即使我不允许共享它,我还是想要它自己)例如在Google Play上).我已经看到了许多有关如何更改应用程序语言的答案,这不是我想要的.我还在Google Play中找到了许多应用程序,它们都承诺快速切换系统语言"等,但是它们都无法在我的设备上运行.我最近得到的是 this ,但看起来像是死线程.

那么,有可能吗?如果是这样,文档在哪里?

解决方案

我认为这是您可能需要的!!

如果您想拥有自己的应用程序,可以尝试我刚刚为您创建的该应用程序这里 !!!

语言选择器小工具

Java代码

public class MainActivity extends Activity {
    private Button btn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        btn = (Button)findViewById(R.id.add_button);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //in the line below it tells it to go to the language selection list
                Intent intent = new Intent(Settings.ACTION_LOCALE_SETTINGS);
                startActivity(intent);
                MainActivity.this.finish();


            }
        });
    }

}

布局文件

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">


    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Change System Language"
        android:id="@+id/add_button"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true" />
</RelativeLayout>

您可以在Eclipse中启动项目,使用上面的代码进行活动和布局,然后在模拟器上进行测试

I'm studying mandarin and want to change the language of my Android smartphone (Sony Xperia) between english/mandarin (or english/mandarin/portuguese/spanish) faster than using the default system settings. The way it is, I have to enter settings, scroll to the middle of it (which is slower than if it was on the beginning or end of the list), click Language & input, click language, have to scroll all the way down to 中文 (it should already be at the top, among the "recently used languages", but only my native language is always there), click 中文 and finally click ok.

I would like to reduce those 6+ clicks to a single button in the quick settings area (there is space for 4 more icons): when the phone is in a language, a tap on the icon would change to the next language, holding the icon would open a menu to add/remove languages/change order/etc.

I'm new to Android development, so I don't know if it's possible for an app to change the system language (need root privileges? I want it for myself, even if I won't be allowed to share it on Google Play, for instance). I've seen many answers on how to change an app language, that's not what I'm looking for. I also found many apps in Google Play, all of them promising to "quick toggle system language" etc, but none of them worked on my device. The closest I got was this, but looks like a dead thread.

So, is it possible? If so, where is the documentation?

解决方案

I think this is what you might looking for!!!

If you would like to have your own application you can try this app i just created for you here!!!

Language Picker Widget

The Java Code

public class MainActivity extends Activity {
    private Button btn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        btn = (Button)findViewById(R.id.add_button);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //in the line below it tells it to go to the language selection list
                Intent intent = new Intent(Settings.ACTION_LOCALE_SETTINGS);
                startActivity(intent);
                MainActivity.this.finish();


            }
        });
    }

}

The Layout File

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">


    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Change System Language"
        android:id="@+id/add_button"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true" />
</RelativeLayout>

You can start a project in eclipse, use the codes above for the activity and the layout and then test it on the emulator

这篇关于快速更改Android系统语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆