Example usage for android.widget Spinner MODE_DROPDOWN

List of usage examples for android.widget Spinner MODE_DROPDOWN

Introduction

In this page you can find the example usage for android.widget Spinner MODE_DROPDOWN.

Prototype

int MODE_DROPDOWN

To view the source code for android.widget Spinner MODE_DROPDOWN.

Click Source Link

Document

Use a dropdown anchored to the Spinner for selecting spinner options.

Usage

From source file:de.aw.monma.views.SpinnerAccount.java

public SpinnerAccount(Context context) {
    this(context, Spinner.MODE_DROPDOWN);
}

From source file:de.aw.monma.views.SpinnerAccount.java

public SpinnerAccount(Context context, AttributeSet attrs, int defStyleAttr) {
    this(context, attrs, defStyleAttr, Spinner.MODE_DROPDOWN);
    init(context, attrs);
}

From source file:ru.adios.budgeter.widgets.DataTableLayout.java

private void loadDataAndPopulateTable() {
    new AsyncTask<DataStore, Void, Integer>() {
        @Override//from www . jav  a  2  s. c o m
        protected Integer doInBackground(DataStore... params) {
            return params[0].count();
        }

        @Override
        protected void onPostExecute(Integer c) {
            count = c;
            if (c == 0) {
                insertNoDataRow();
                tablePopulated = true;
                if (listener.isPresent()) {
                    listener.get().accept(DataTableLayout.this);
                }
                invalidate();
                return;
            }

            if (currentPage == 0) {
                turnToPage(1, false);
            }
            if (c > pageSize) {
                final Context context = getContext();

                if (tableName.isPresent()) {
                    pageSizeSpinner = new Spinner(context, Spinner.MODE_DROPDOWN);
                    pageSizeSpinner.setMinimumWidth(UiUtils.dpAsPixels(context, 70));
                    pageSizeSpinner.setId(ElementsIdProvider.getNextId());
                    final List<Integer> contents = getPageSpinnerContents();
                    spinnerContents = Optional.of(contents);
                    pageSizeSpinner.setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_spinner_item,
                            android.R.id.text1, contents));
                    pageSizeSpinner.setSelection(contents.indexOf(pageSize));
                    pageSizeSpinner.setLayoutParams(new LinearLayout.LayoutParams(
                            TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT, 2f));
                    pageSizeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                        @Override
                        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                            setPageSize((Integer) parent.getAdapter().getItem(position));
                        }

                        @Override
                        public void onNothingSelected(AdapterView<?> parent) {
                        }
                    });
                    pageSizeSpinner.setVisibility(VISIBLE);

                    if (!titleView.isPresent()) {
                        addTitleRowWithSeparator(context, 10f, 8f);
                    } else {
                        titleView.get().setWeightSum(10f);
                        titleView.get().getChildAt(0).setLayoutParams(
                                new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                                        LinearLayout.LayoutParams.WRAP_CONTENT, 8f));
                    }
                    titleView.get().addView(pageSizeSpinner, 0);
                }
                final TableRow.LayoutParams fp = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT,
                        TableRow.LayoutParams.WRAP_CONTENT, 1f);
                fp.span = itemsPerInnerRow;
                footer.setLayoutParams(fp);
                footer.setVisibility(VISIBLE);
                populateFooter();
            }
            loadTableProcedures();
        }
    }.execute(dataStore);
}