简体   繁体   中英

Different language on textview in Android

我怎么能在Android上的textview或edittext上编写不同的语言(Bangla),为此我需要什么版本的API

If you use strings.xml to add a level of indirection for string values, then you can easily localize your strings as in:

android:text="@string/main_text_view_hello"

So I have a strings.xml in folders:

res/values
res/values-en-rCa
res/values-en-rGB

Any time I want to change a value for Canada or United Kingdom, I just add it to the appropriate folder. All other values are obtained by default from res/values.

You can set text with TextView.setText(String-ID) . String-IDs are managed in strings.xml files which are under res/values folder. If you want another language for example german you need another strings.xml file with the same String-IDs in res/values-de. In android layout files you can reference such string ids with @string/stringid.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM