如何在values文件夹里的strings.xml定义属性?

expiator 2014-05-28 09:17:14
在网上看到preferencefragment 的使用。就照着例子敲了一遍代码。
网址 :http://blog.csdn.net/wh_19910525/article/details/8505268
结果出错:
Error: No resource found that matches the given name (at 'entries' with value '@array/
entries_list_preference').
好像是没有在values里的strings.xml定义属性。。怎么定义啊?

strings.xml如下:
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="app_name">MainAcitivity</string>
<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string>

</resources>

...全文
239 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
fireyou 2014-05-30
  • 打赏
  • 举报
回复
item1,2,3换成你想要的string
expiator 2014-05-30
  • 打赏
  • 举报
回复
引用 1 楼 lieri111 的回复:
可以加上

<string-array
        name="entries_list_preference" >
        <item>1</item>
        <item>2</item>
        <item>3</item>
    </string-array>
这里面item1,2,3是指什么?能换成其他的内容吗?
passself 2014-05-28
  • 打赏
  • 举报
回复
可以加上

<string-array
        name="entries_list_preference" >
        <item>1</item>
        <item>2</item>
        <item>3</item>
    </string-array>
00oo-- 2014-05-28
  • 打赏
  • 举报
回复
引用 1 楼 lieri111 的回复:
可以加上

<string-array
        name="entries_list_preference" >
        <item>1</item>
        <item>2</item>
        <item>3</item>
    </string-array>
就是这样

80,361

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧