Spinner arrow disappears when I change the background color
Asked Answered
H

1

7

When I change the background color of my spinner, the drop-down arrow disappears. I have seen some answers to similar questions here, but they don't really address how to make the arrow "reappear" or change the arrow's color directly from the XML (assuming that's possible).

I am trying to make the arrow white, but the spinner (using the code below) still appears without the arrow.

<Spinner
    android:id="@+id/eventSpinner"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_alignParentTop="true"
    android:background="@android:color/holo_green_dark"
    android:dropDownSelector="#ffffff"
    android:popupBackground="@android:color/holo_green_dark"
    android:spinnerMode="dropdown" />

Any help would be appreciated. Thanks in advance.

Hall answered 20/8, 2015 at 19:1 Comment(0)
W
0

You can draw line by xml code. like below

    <item >

    <layer-list>

        <item>
            <shape android:shape="rectangle" >
                <solid android:color="@android:color/transparent" />
                <!-- background color of box -->
            </shape>
        </item>
        <item
            android:left="-2dp"
            android:right="-2dp"
            android:top="-2dp">
            <shape>
                <solid android:color="@android:color/transparent" />

                <stroke
                    android:width="1dp"
                    android:color="#323232" />
                <!-- color of stroke -->
            </shape>
        </item>

        <item android:right="5dp">
            <bitmap android:gravity="center_vertical|right" android:src="@drawable/downlarrow" />

        </item>

    </layer-list>

   </item>

output looks something like this enter image description here

Whitaker answered 15/1, 2017 at 7:3 Comment(1)
that drop down is a image you can change it, if you needWhitaker

© 2022 - 2024 — McMap. All rights reserved.