Remove text from the spinner

I am trying to create a spinner. I currently havescreen1

This is EditTextfollowed by Spinner.


Now I use custom style as follows screen2

It also consists of EditTextfollowed by Spinner, but Spinnerhas some text (in this case, “Other”) on it, which is the name of the element 1 .

How to delete this text, i.e. the content of the item should not be displayed on Spinner.
Spinnerdoes not have an attribute textSize, otherwise I would set it to 0 .

I try this with a few hours, but not a solution.
Any help appreciated.

+1
source share
3

, . :

private static class CustomAdapter<T> extends ArrayAdapter<String> {
        public CustomAdapter(Context context, int textViewResourceId, String[] objects) {
            super(context, textViewResourceId, objects);
        }

        public View getView(int position, View convertView, ViewGroup parent) {
            View view = super.getView(position, convertView, parent);
            TextView textView = (TextView) view.findViewById(android.R.id.text1);
            textView.setText("");
            return view;
        }       
}

R.id.spinner , :

Spinner spinner = (Spinner) findViewById(R.id.spinner);
CustomAdapter<String> adapter = new CustomAdapter<String>(this, 
    android.R.layout.simple_spinner_dropdown_item, new String[] {"Entry 1", "Entry 2"});
spinner.setAdapter(adapter);

, String [] , .

+10

"". (.. qoutation .)

0

, Android QuickAction Widget. Link

GitHub. Spinner QucikAction. .

enter image description here

Please follow the link below.

https://github.com/lorensiuswlt/NewQuickAction3D

0
source

Source: https://habr.com/ru/post/1790652/


All Articles