如何获取当前的键盘语言 [英] How to get current keyboard language

查看:149
本文介绍了如何获取当前的键盘语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写这是使用字典的应用程序。我想任何时候用户变更输入语言词典之间进行切换。例如,如果打字语言是英语词典英语工作,如果它是德国,与德国字典工作。有没有什么办法来设置一个侦听器来获得这种变化?所有我找到了答案是关于区域而不是关于输入语言。我不想处理的语言环境,语言环境在应用程序没有任何影响,输入语言一样。 (我在minSDK发展= 7)


解决方案

  InputMethodManager IMM =(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);InputMethodSubtype IMS = imm.getCurrentInputMethodSubtype();字符串的语言环境= ims.getLocale();

您可以试试这个code来获得当前的键盘区域语言code。

I am writing an application which is using dictionaries. I want to switch between dictionaries any time user change input language. For example if the typing language is english work with english dictionary, if it is german, work with german dictionary. Is there any way to set a listener to get that change? All the answer i found were about locale and not about input language. I don't want to handle locale, locale has no effect in application, the input language does. (I am developing in minSDK=7)

解决方案

InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);

InputMethodSubtype ims = imm.getCurrentInputMethodSubtype();

String locale = ims.getLocale();

You can try this code to get Current Keyboard Language regional code.

这篇关于如何获取当前的键盘语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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