Android Spinner in Toolbar Arrow

  • Replies:1
  • OpenNot stickiedUnanswered
  • Forum posts: 27

Aug 20, 2016 8:13:05 PM via Website

I want to have a Spinner in my Toolbar. However, the Spinner doesn't have any dropdown arrow, as the default Android Spinner does.

How do I make it have an arrow?

This is my code:

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="104dp"
    android:gravity="top"
    app:titleTextColor="@color/White"
    android:layout_gravity="right"
    android:layoutDirection="rtl"
    app:layout_scrollFlags="scroll|enterAlways"
    app:layout_collapseMode="pin"
    app:contentScrim="?attr/colorPrimary"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
    app:titleMarginTop="15dp">
  <Spinner
     android:id="@+id/Location_Spinner"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_marginLeft="10dp"/>

Fragment where I show the spinner:

  var spinner = Activity.FindViewById<Spinner>(Resource.Id.Location_Spinner);
 var adapter = ArrayAdapter.CreateFromResource(Activity, Resource.Array.locations_array, Android.Resource.Layout.SimpleSpinnerItem);
 adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
 spinner.Adapter = adapter;

Any ideas why there isn't an arrow?
Thanks.

  • Forum posts: 33

Aug 23, 2016 6:56:28 AM via Website

It seems that dropdown arrow do not appear on pre lollipop. You can set the background to the Spinner. Read this