I have a nice green background that I'm displaying behind the spinner - the spinner sits in front of the background.
You can see that it looks really bad as the spinner can be clearly distinguished from it's background.
I would like to make the spinner background transparent when the dialog for the spinner is CLOSED. When the dialog is OPENED, the spinner can then take on the darker green. Currently, when the dialog is OPENED or CLOSED, the same darker green is used in the layout:
CURRENT LOOK OF SPINNER WHEN CLOSED:
WHAT I WANT THE SPINNER TO LOOK LIKE WHEN CLOSED
WHAT THE SPINNER LOOKS LIKE WHEN OPENED:
I load the spinner using an adapter by doing this:
ArrayAdapter<String> ageAdapter = new ArrayAdapter<String>(this,
R.layout.spinner_age, R.id.spinner_item, generateAgeRange());
ageSpinner.setAdapter(ageAdapter);
I know that the R.layout.spinner_age
xml determines how the spinner layout would look:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="12sp"
android:background="@color/primary_darker"
android:textColor="@color/white"
tools:text="Hello"
android:gravity="left"
android:padding="12dp"
android:id="@+id/spinner_item"/>
</LinearLayout>
Is there a way to load a layout xml for when the dialog is CLOSED and when the dialog is OPENED so that I can achieve the effect I want?