How to create a spinner with a rectangular box with a triangular drop-down arrow?

advertisements

I need to create a spinner with rectangular border with triangle drop down arrow. How to create such spinner? I tried but my actual output difers from expected output. Here is expected output.

But my output looks like this.

How to create a spinner with drop down image with rectangular box?

Here is my code which I applied.

       <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="1dip"
        android:orientation="vertical" >
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:text="Preferred contact method">
        </TextView>
        <Spinner
            android:id="@+id/account_spinner"
            android:layout_width="match_parent"
            android:layout_height="70dp"
            android:layout_marginTop="2dp"
            style="@style/Base.Widget.AppCompat.Spinner.Underlined"
            />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:text="Telephone">
        </TextView>

        <EditText
            android:layout_width="match_parent"
            android:layout_height="30dp"
            android:inputType="phone"
            android:ems="10"
            android:background="@drawable/edittext_border"
            android:id="@+id/editText" />

EditText border.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="#ffffff" />

<stroke
    android:width="1dp"
    android:color="#000000" />

But how to apply for spinner with triangle arrow and outer rectangle border?

Thanks in advance.


It just renders like that in the XML layout preview because Preview doesn't know what data you want to bind to the spinner. It will look like a normal spinner with the drop down arrow once you run it on a device or emulator.