0

I want that my button looks like a spinner, because I will show a special dialog if the button is clicked. I use Theme.MaterialComponents and tried following but it's not working:

<Button
            android:id="@+id/btMusclegroups"
            style= "?spinnerStyle"// or style="@style/Widget.AppCompat.Spinner"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

The button still looks solid and not like a spinner.

Desired result

I want that my button looks the same as following Spinner:

<Spinner
            android:id="@+id/btMusclegroups"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

I could use a Spinner with OnTouchListener and a dummy adapter (I don't need the adapter, my dialog knows all the data it needs already) but I'd prefer the above way - is this somehow achievable?

prom85
  • 16,896
  • 17
  • 122
  • 242
  • Does this answer your question? [How do I create an Android Spinner as a popup?](https://stackoverflow.com/questions/6286847/how-do-i-create-an-android-spinner-as-a-popup) – Bö macht Blau Feb 21 '20 at 20:57
  • No, I'm just talking about the styling. I want a spinner look + a button behaviour – prom85 Feb 21 '20 at 21:04

1 Answers1

0

Create a container and add an image view containing the dropdown symbol for the spinner and a button. Add an OnClickListener to the button that calls the dialog and updates the text of the button. Don't forget to style the button as NoBackground.

Cabaleiro
  • 1
  • 1