0

インテントを使用してリスト ビューを作成しましたが、アプリのユーザー エクスペリエンスを向上させるために、リスト ビューで選択した項目の色を変更するにはどうすればよいですか。パレットからのリスト ビューではなく、ListActivity クラスを直接使用したので、コードをアクティビティに直接追加するには、ここに私のコードがあります

public class BreakfastListView extends ListActivity {

    static final String[] breakfood = {
        "Strawberry shake",
        "Egg muffin",
        "Morning sundae",
        "Peanut butter pancakes w banana",
        "Dippy eggs w marmite soldiers",
        "Breakfast burrito",
        "Ham and cheese muffin",
        "Bacon, egg and cheese bagel",
        "Yoghurt mashup",
        "Hot cereal mashup"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setListAdapter(new ArrayAdapter<String>(this, 
                android.R.layout.simple_list_item_1, breakfood));
        // Setting up the list array above

        }

    protected void onListItemClick(ListView lv, View v, int position, long id){
        super.onListItemClick(lv, v, position, id);
        String openbreakclass = breakfood[position];
        if( "Strawberry shake".equals(openbreakclass))
        {
         Intent selectedIntent = new Intent(v.getContext(), Strawberry_Shake.class );
                               startActivity(selectedIntent);
        } else if("Egg muffin".equals(openbreakclass))
        {
         Intent selectedIntent = new Intent(v.getContext(), Egg_muffin.class );
                                startActivity(selectedIntent);  
        }else if("Morning sundae".equals(openbreakclass)){
            Intent selectedIntent = new Intent(v.getContext(), Morning_sundae.class );
            startActivity(selectedIntent);
        }else if("Peanut butter pancakes w banana".equals(openbreakclass)){
            Intent selectedIntent = new Intent(v.getContext(), Peanut_butter_pancakes_w_banana.class );
            startActivity(selectedIntent);
        }else if("Dippy eggs w marmite soldiers".equals(openbreakclass)){
            Intent selectedIntent = new Intent(v.getContext(), Dippy_eggs_w_marmite_soldiers.class );
            startActivity(selectedIntent);
        }else if("Breakfast burrito".equals(openbreakclass)){
            Intent selectedIntent = new Intent(v.getContext(), Breakfast_burrito.class );
            startActivity(selectedIntent);
        }else if("Ham and cheese muffin".equals(openbreakclass)){
            Intent selectedIntent = new Intent(v.getContext(), Ham_and_cheese_muffin.class );
            startActivity(selectedIntent);
        }else if("Bacon, egg and cheese bagel".equals(openbreakclass)){
            Intent selectedIntent = new Intent(v.getContext(), Bacon_egg_and_cheese_bagel.class );
            startActivity(selectedIntent);
        }else if("Yoghurt mashup".equals(openbreakclass)){
            Intent selectedIntent = new Intent(v.getContext(), Yoghurt_mashup.class );
            startActivity(selectedIntent);
        }else if("Hot cereal mashup".equals(openbreakclass)){
            Intent selectedIntent = new Intent(v.getContext(), Hot_cereal_mashup.class );
            startActivity(selectedIntent);
        }

    }
4

1 に答える 1