I learned how to style items in a list, as well as a displayed item. The solution included the creation of two layouts of xml files in the / res / layout directory - one for the spinner drop-down elements and one for the selector (the displayed element). Then I was able to add view resources to the ArrayAdapter.
R.layout.spinner_dropdown_text_view:
<?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/spinnerDropdownTextView" android:layout_width="match_parent" android:layout_height="50dp" android:paddingLeft="10dp" android:gravity="center_vertical" android:textSize="18dp" />
R.layout.spinner_selector_text_view:
<?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/spinnerSelectorTextView" android:layout_width="210dp" android:layout_height="match_parent" android:paddingTop="12dp" android:textSize="18dp" android:textColor="@android:color/black" />
ArrayAdapter Code:
ArrayAdapter<CharSequence> aa = ArrayAdapter.createFromResource(this, R.array.rooms, R.layout.spinner_selector_text_view); aa.setDropDownViewResource(R.layout.spinner_dropdown_text_view);
Result:

Unfortunately, I was not able to figure out how to add switches, or how to remove any horizontal line.
source share