I am having an issue with a spinner in my layout.
The issue is that my items have very small width and on a small screen it is pretty hard do click them.
Check the picture for idea.
Is there no easy way of setting the item width to the actual dropdownmenue width?
<android.support.v7.widget.AppCompatSpinner
android:id="@+id/spellSpinner"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:dropDownWidth="match_parent"
android:spinnerMode="dropdown"
android:popupBackground="#fff"
android:background="#8A8A8A"/>
My Java Code:
spinnerSpells = findViewById(R.id.spellSpinner);
ArrayAdapter < CharSequence > adapter = ArrayAdapter.createFromResource(spellActivity.this, R.array.dropdownCategory, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerSpells.setAdapter(adapter);
spinnerSpells.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView << ? > adapterView, View view, int i, long l) {
getSpellList(spinnerSpells.getSelectedItem().toString(), switchSpells.isChecked());
// do some other stuff [...]
}
@Override
public void onNothingSelected(AdapterView << ? > adapterView) {
getSpellList(spinnerSpells.getSelectedItem().toString(), switchSpells.isChecked());
// do some other stuff [...]
}
});
With best regards CG
P.S. I really did not find any post in the forum about that matter.