小编use*_*640的帖子

Android - 文本下拉/选择Spinner不显示

我正在使用此示例代码填充Spinner.从数据库中读取数据.选择正确显示 - 在这种情况下,它显示"绿色"和"红色".

    Spinner spinnerColor = (Spinner) findViewById(R.id.spinnertProfile);

    mProfileDbHelper = new ProfileDbAdapter(this);
    mProfileDbHelper.open();

    Cursor profilesCursor = mProfileDbHelper.fetchAllProfiles();
    startManagingCursor(profilesCursor);

    // Create an array to specify the fields we want to display in the list
    String[] from = new String[] { ProfileDbAdapter.COL_PROFILE_TITLE };

    // and an array of the fields we want to bind those fields to
    int[] to = new int[] { R.id.textviewColors };

    // Now create a simple cursor adapter and set it to display
    SimpleCursorAdapter profilesAdapter = new SimpleCursorAdapter(this, …
Run Code Online (Sandbox Code Playgroud)

android spinner android-widget

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×1

android-widget ×1

spinner ×1