android - Spinner items populated from SimpleCursorAdapter are not showing -
i have spinner populated items simplecursoradapter. problem - aren't visible in spinner, nevertheless can pick 1 , visible selected item:
here relevant code:
main2activity.java:
cursorloader cl = new cursorloader(main2activity.this, contentprovider.createuri(category.class, null), null, null, null, null); cursor cursor = cl.loadinbackground(); final simplecursoradapter cursoradapter = new simplecursoradapter(main2activity.this, android.r.layout.simple_spinner_dropdown_item, cursor, new string[]{"name"},new int[]{android.r.id.text1}, 0); cursoradapter.setdropdownviewresource(r.layout.spinner_item); cursoradapter.notifydatasetchanged(); spinner.setadapter(cursoradapter);
content_main.xml:
<spinner android:layout_width="wrap_content" android:layout_height="wrap_content" android:spinnermode="dropdown" android:id="@+id/spinner"/>
spinner_item.xml:
<?xml version="1.0" encoding="utf-8"?> <textview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:textsize="16sp" android:gravity="left" android:padding="5dp"/>
Comments
Post a Comment