0

我想<item>Repeat 5 times</item>在用户选择时禁用我<item>Repeat 4 time </item>如何实现这个?

    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.Replay_arrays, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);
    replay.setAdapter(adapter);
    replay.setOnItemSelectedListener(new function());

    public class function implements OnItemSelectedListener {
        @Override
        public void onItemSelected(AdapterView<?> parent, View arg1, int pos,
                long id) {
            int poss = replay.getSelectedItemPosition();
            switch (poss){
            case 0: 
                maxCount = 1188;
                break;
            case 1: 
                maxCount = 4;
            break;
            case 2: 
                maxCount = 5;
                break;
            case 3: 
                maxCount = 6;
                break;
            case 4: 
                maxCount = 7;
                break;
            case 5: 
                maxCount = 8;
                break;
            }   
        }

        @Override
        public void onNothingSelected(AdapterView<?> arg0) {

        }

    }

字符串.xml

    <string name="Replay_prompt">Replay</string>
<string-array name="Replay_arrays">
    <item>Timer: Off</item>
    <item>Repeat 4 time </item>
    <item>Repeat 5 times</item>
    <item>Repeat 6 times</item>
    <item>Repeat 7 times</item>
    <item>Repeat 8 times</item>        
</string-array>
4

0 回答 0