5

私はprefs.xmlを持っています

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >

    <CheckBoxPreference
        android:title="aaa"
        android:defaultValue="true"
        android:key="checkbox"
        android:summary=""/>

    <CheckBoxPreference
        android:title="bbb"
        android:defaultValue="true"
        android:key="checkbox1"
        android:summary=""/>

    <ListPreference
        android:title="first page"
        android:key="first_page"
        android:summary="ccc"
        android:defaultValue="3"
        android:entries="@array/list"
        android:entryValues="@array/lvalues"
        ></ListPreference>



</PreferenceScreen>

array.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string-array name="list">
     <item >1</item>
     <item >2</item>
     <item >3</item>       
     <item >4</item>       


    </string-array>

     <string-array  name="lvalues">

     <item >1</item>
     <item >2</item>
     <item >3</item>       
     <item >4</item>        


     </string-array> 



</resources>

そして、ユーザー設定に従って最初のページを表示するためにこれを使用するために、メイン Java クラスの「スイッチ - ケース」で ListPreference の entryvalues を使用したいと考えています。これどうやってするの?助けてくれてありがとう!

4

0 に答える 0