I had the same problem and I used the OP code as the basis for creating this solution:
final Spinner spinner = (Spinner)fragmentView.findViewById(R.id.spinner); List<Map<String, String>> items = new ArrayList<Map<String, String>>(); Map<String, String> item0 = new HashMap<String, String>(2); item0.put("text", "Browse aisles..."); item0.put("subText", "(Upgrade required)"); items.add(item0); Map<String, String> item1 = new HashMap<String, String>(2); item1.put("text", "Option 1"); item1.put("subText", "(sub text 1)"); items.add(item1); Map<String, String> item2 = new HashMap<String, String>(2); item2.put("text", "Option 2"); item2.put("subText", "(sub text 2)"); items.add(item2); SimpleAdapter adapter = new SimpleAdapter(getActivity(), items, android.R.layout.simple_spinner_item,
You can also replace android.R.layout.simple_spinner_item
and / or android.R.layout.simple_list_item_2
with your own views (which are usually located in the layout
folder).
This is a much better solution than PhoneGap !: D
source share