开发者

Different language on textview in Android

开发者 https://www.devze.com 2023-03-05 17:38 出处:网络
how can i w开发者_StackOverflow中文版rite different language (Bangla) on textview or edittext in Android and for this What version of API i have to need If you use strings.xml to add a level of indire

how can i w开发者_StackOverflow中文版rite different language (Bangla) on textview or edittext in Android and for this What version of API i have to need


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号