开发者

How to show text and value on Listpreference list

I'm trying to show the Listpreference list with both assigned arrays. Arrays look something like this.

level_array

     <item name="level1">Level  1 -   Hi-Score: </item>
     <item name="level2">Level  2 -   Hi-Score: </item>

v开发者_运维知识库alue_array

     <item name="level1">5</item>
     <item name="level2">10</item>

when I call the listpreference, I'd like it to show both strings combined. Is this possible?

IE would show list like this

LIST TITLE

Level 1 - Hiscore 5

Level 2 - Hiscore 10

etc.

Secondary question, I'm guessing the value_array values are changeable via code so I can store different values there later?

Thanks


use ListPreference, use something like this

<ListPreference
    android:title="Weather"
    android:summary="You can simulate the weather"
    android:key="listPref"
    android:entries="@array/level_array"
    android:entryValues="@array/value_array" />

Is you want change your xml, I think there won't be a problem

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜