androidandroid-edittextspinner

Set Spinner adapter then EditText input type changed


I have set spinner to ArrayAdapter as String list.

                        // Creating adapter for spinner
                        ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(LoginActivity.this, R.layout.row_spinner, countryCodeList);
                        dataAdapter.setDropDownViewResource(R.layout.row_spinner);

                        // attaching data adapter to spinner
                        spinnerCountryCode.setAdapter(dataAdapter);

In this set spinner adapter successfully but LoginActivity I have also other EditText control as InputType number.

My problem is after spinner adapte set click on Edittext then first open number keyboard and then after immediate open system text keyboard.

I have also set EditText input type as number

android:inputType="number" 

And manifest file set windowSoftInputMode is

android:windowSoftInputMode="stateAlwaysHidden|adjustPan"

Thanks in advance..!


Solution

  • something is wrong with your R.layout.row_spinner , try adding android.R.layout.simple_spinner_item in place of R.layout.row_spinner and run once

       ArrayList<String> values;
    
     values = new ArrayList<>();
            values.add("value1");
            values.add("value1");
            values.add("value1");
            values.add("value1");
    
            // Creating adapter for spinner
            ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(MainActivity.this, android.R.layout.simple_spinner_item, values);
            dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
    
            // attaching data adapter to spinner
            spinner.setAdapter(dataAdapter);
    

    enter image description here