I’m using default spinner
<Spinner
android:id="@+id/mySpinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(getApplicationContext(),
android.R.layout.simple_spinner_item);
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
((Spinner)findViewById(R.id.mySpinner)).setAdapter(spinnerAdapter);
How come elements are on a white background and a foreground color gray? It seems strange to me…
The reason is you set it with
android.R.layout.simple_spinner_item.You can write your own Adapter class:
Then it will look like the way you design in
spinner_layout.