-2

Hello everyOne i ask how can i add some icons to arrayList in this code

spinnerList = new ArrayList();
        spinnerList.add("Item1") ;
        spinnerList.add("Item2");
        spinnerList.add("Item3");
        spinnerList.add("Item4");


         adapter = new ArrayAdapter(this,
                android.R.layout.simple_spinner_item, spinnerList);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        actionBar.setListNavigationCallbacks(adapter, this);
        removeItemInActionBar(2);
Soft Grip
  • 15
  • 3

1 Answers1

0

You can't assign the icons to the ArrayList directly, but you can use a custom Adapter that adds an icon next to the text. An example of how to do this can be found here: Custom ArrayList Adaptor - Displaying Icons in the the ActionBar List.

Community
  • 1
  • 1
barq
  • 3,681
  • 4
  • 26
  • 39