android獲取系統(tǒng)語言,Android系統(tǒng)調(diào)用

android判斷當(dāng)前系統(tǒng)用的是什么語言

判斷國家:

成都創(chuàng)新互聯(lián)公司-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價比羅莊網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式羅莊網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋羅莊地區(qū)。費(fèi)用合理售后完善,十載實(shí)體公司更值得信賴。

中文:getResources().getConfiguration().locale.getCountry().equals("CN")

繁體中文: getResources().getConfiguration().locale.getCountry().equals("TW")

英文(英式):getResources().getConfiguration().locale.getCountry().equals("UK")

英文(美式):getResources().getConfiguration().locale.getCountry().equals("US")

如果不清楚當(dāng)前國家的簡寫,可以直接System.out(getResources().getConfiguration().locale.getCountry());打印出來即可

Android如何獲取當(dāng)前操作系統(tǒng)的語言

使用如下代碼判斷語言(這里判斷下中文):

public static boolean isZh(Context context) {

Locale locale = context.getResources().getConfiguration().locale;

String language = locale.getLanguage();

if (language.endsWith("zh"))

return true;

else

return false;

}

下面是判斷國家:

中文:getResources().getConfiguration().locale.getCountry().equals("CN")

繁體中文:?getResources().getConfiguration().locale.getCountry().equals("TW")

英文(英式):getResources().getConfiguration().locale.getCountry().equals("UK")

英文(美式):getResources().getConfiguration().locale.getCountry().equals("US")

如果不清楚當(dāng)前國家的簡寫,可以直接

System.out(getResources().getConfiguration().locale.getCountry());打印出來即可。

Android怎么獲取當(dāng)前操作系統(tǒng)的語言

Android--獲取當(dāng)前系統(tǒng)的語言環(huán)境其代碼如下:

private boolean isZh() {

Locale locale = getResources().getConfiguration().locale;

String language = locale.getLanguage();

if (language.endsWith("zh"))

return true;

else

return false;

}

其中l(wèi)anguag為語言碼:

zh:漢語

en:英語

如何在android APP中設(shè)置系統(tǒng)語言

獲取當(dāng)前系統(tǒng)語言

Locale?curLocale?=?getResources().getConfiguration().locale;

//通過Locale的equals方法,判斷出當(dāng)前語言環(huán)境

if?(curLocale.equals(Locale.SIMPLIFIED_CHINESE))?{

//中文

}?else?if(Locale.ENGLISH){

//英文

}

2.設(shè)置APP語言Resources?resources?=?getResources();??//?獲得res資源對象 ? ?

Configuration?config?=?resources.getConfiguration();??//?獲得設(shè)置對象

DisplayMetrics?dm?=?resources.getDisplayMetrics();??//?獲得屏幕參數(shù):主要是分辨率,像素等。

config.locale?=?Locale.ENGLISH/span;??//?設(shè)置APP語言設(shè)置為英文

resources.updateConfiguration(config,?dm);

//設(shè)置完以后要刷新Activity才能及時生效

android手機(jī)怎么提取系統(tǒng)語言標(biāo)識

Android--獲取當(dāng)前系統(tǒng)的語言環(huán)境其代碼如下:

private boolean isZh() {

Locale locale = getResources().getConfiguration().locale;

String language = locale.getLanguage();

if (language.endsWith("zh"))

return true;

else

return false;

}

其中l(wèi)anguag為語言碼:

zh:漢語

en:英語

Android獲取系統(tǒng)語言

Locale locale = getResources().getConfiguration().locale;

String language = locale.getLanguage();

String local = Locale.getDefault().toString();

String country =getResources().getConfiguration().locale.getCountry();

Log.e("zxy", "tjCountry: language:"+ language+",local:"+local+",country:"+country);

2019-05-20 14:35:13.231 28892-28892/? E/zxy: tjCountry: language:ko,local:ko_KR,country:KR

2019-05-20 14:36:35.851 2357-2357/? E/zxy: tjCountry: language:it,local:it_IT,country:IT

2019-05-20 14:37:20.689 3848-3848/? E/zxy: tjCountry: language:th,local:th_TH,country:TH

2019-05-20 14:37:42.060 4893-4893/? E/zxy: tjCountry: language:sk,local:sk_SK,country:SK

2019-05-20 14:38:30.373 6402-6402/? E/zxy: tjCountry: language:zh,local:zh_CN_#Hans,country:CN

2019-05-20 14:38:45.746 7024-7024/? E/zxy: tjCountry: language:ms,local:ms_SG,country:SG

2019-05-20 14:39:26.728 8264-8264/? E/zxy: tjCountry: language:zh,local:zh_CN_#Hans,country:CN

2019-05-20 14:39:47.535 9051-9051/? E/zxy: tjCountry: language:ms,local:ms_MY,country:MY

2019-05-20 14:41:21.035 10903-10903/? E/zxy: tjCountry: language:zh,local:zh_CN_#Hans,country:CN

2019-05-20 14:41:30.611 10903-10903/? E/zxy: tjCountry: language:fr,local:fr_CA,country:CA

2019-05-20 14:47:39.545 13311-13311/? E/zxy: tjCountry: language:zh,local:zh_CN_#Hans,country:CN

2019-05-20 14:47:59.557 14123-14123/? E/zxy: tjCountry: language:en,local:en_GB,country:GB

分享名稱:android獲取系統(tǒng)語言,Android系統(tǒng)調(diào)用
新聞來源:http://muchs.cn/article36/pheisg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊、手機(jī)網(wǎng)站建設(shè)網(wǎng)站排名、網(wǎng)站設(shè)計公司ChatGPT、網(wǎng)頁設(shè)計公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)公司