开发者

problem with spinner

开发者 https://www.devze.com 2023-03-11 21:35 出处:网络
what did I do wrong? My spinner was filled in, but I see only amount of lines, which corresponds the amount of data? But I didn\'t see the name of data.

what did I do wrong? My spinner was filled in, but I see only amount of lines, which corresponds the amount of data? But I didn't see the name of data.

SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, android.R.layout.simple_list_item_1, cursor, new String[] { Manufacturer.colMarke }, new int[] { android.R.id.text1 });
    Spinner marke = (Spinner) findViewById(R.id.spinner2);
    marke.setAdapter(adapter);

And xml

<Spinner
    android:id="@+id/spinn开发者_StackOverflower2"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"/>


you forgot ad _id column in your cursor or forgot to call:

adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

before

marke.setAdapter(adapter);
0

精彩评论

暂无评论...
验证码 换一张
取 消