从string.xml资源文件取决于Android的性别负载 [英] Load from string.xml resources files depending on gender in android

查看:191
本文介绍了从string.xml资源文件取决于Android的性别负载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的应用程序,其中,当用户是男性还是女性主题和字符串不同。
我能控制取决于用户的性别色彩,但现在我解决不了串的问题
例如,如果用户是男性,我会用

I am working on application where themes and strings differs when user is male or female. I could control colors depending on user gender but now i can't solve problem of strings for example if user is a male, I will use

<string name="welcome">Welcome boy</string>

,但如果用户雌性这将是

but if user female it will be

<string name="welcome">Welcome girl</string>

这仅仅是example.so我怎么可以加载根据性别价值资源正确的文件存储在变量??

that is just for example.so how can i load the correct file from resources depending on gender value which is stored in variable ??

推荐答案

有对你在者平台找什么不直接支持,所以你需要自己编写逻辑,并且每个进入两个字符串(即 welcome_m 男性和 welcome_f 为女性)。但是,你需要根据使用你的应用程序是谁的把它放在你的部件从code。

There's no direct support for what you are looking for in the plaform, so you need to write the logic yourself and have two strings per entry (i.e. welcome_m for males and welcome_f for females). But you need to set it on your widgets from code depending of who is using your app.

这篇关于从string.xml资源文件取决于Android的性别负载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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