如何在android中的strings.xml中的警报对话框中添加项目名称
在我的应用程序中,当我单击按钮时,我将打开警报对话框生成器。我的代码如下
AlertDialog.Builder builder = new AlertDialog.Builder(BannerImage.this);
final CharSequence[] items = {"Skip", "video", "Audio", "Games"};
builder.setTitle(" Funn ");
,而不是在此处键入项目名称,我想从 R.strings.xml
文件添加这些名称 但它显示了一些错误,当我的用户更改区域设置时,我想显示不同的语言,我需要这样做。如何添加字符串文件中的值...
in my app when i click a button i am opening an Alert Dialog builder. My code is as follows
AlertDialog.Builder builder = new AlertDialog.Builder(BannerImage.this);
final CharSequence[] items = {"Skip", "video", "Audio", "Games"};
builder.setTitle(" Funn ");
here instead of typing the items name here i want to add those name from R.strings.xml
file
but it shows some errors, as my user changes the locale i want to show different language for that i need to do like this. How to add the values from strings file...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
然后创建 string.xml 文件
and then create your string.xml file
continue
You neeed to create seperate resource files for each language. E.G
Please read the Localization article for more info.