I need to customize the background color of a DropDown, until I get to do this:
if possible try to give rounded edges and have the same color as the background TextViews (As you can see the background is white), to get to do that, this is my code:
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#bdfbea"
android:fontFamily="@font/comfortaa"
android:padding="20dp"
android:textColor="#00887b"
android:textSize="24sp"
android:textStyle="bold"
android:maxLines="1"/>
//
String[] idiomas = {"ESPAÑOL", "ENGLISH", "PORTUGUES"};
Spinner spinner = (Spinner) v.findViewById(R.id.sp_idioma);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getContext(), R.layout.spinner_textview, idiomas);
adapter.setDropDownViewResource(R.layout.spinner_dropview);
spinner.setAdapter(adapter);
PS: already probe with android:popupBackground="COLOR"
and not to function, also try several solutions on the web, and none with the answer
// --------------------------------------------- ---- AGGREGATED
I use a Contraint Layout to orient the components, my component spinner is configured as follows
<Spinner
android:id="@+id/sp_idioma"
android:layout_width="344dp"
android:layout_height="50dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:background="@drawable/spinner_personalizado"
android:spinnerMode="dialog"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_idioma" />
The Background is the following:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<layer-list>
<item>
<shape>
<solid android:color="#bdfbea" />
<stroke android:width="3dp" android:color="#00887b" />
<padding android:bottom="1dp" android:left="1dp" android:right="15dp" android:top="1dp" />
<corners android:radius="50dp" />
</shape>
</item>
<item>
<bitmap android:gravity="center|right"
android:src="@drawable/img_flecha_spinner"
/>
</item>
</layer-list>
</item>