Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Android, how to create an outlined dropdown menu (spinner) as specified by the material design documentation? [closed]

Material design documentation mentions about outlined dropdown menu, which looks like this:

enter image description here

How to create this in my Android app? In other words, I want to create a spinner with outline and hint on top.

like image 434
mumayank Avatar asked Jan 02 '19 10:01

mumayank


People also ask

Which is used to create a dropdown menu in Android?

In Android, Spinner is used to select one value from a set of values. In the default state, a spinner shows its currently selected value. Touching the spinner displays a drop down menu with all other available values, from which the user can select a new one.

How to use spinner in Android app explain with an example?

Example to demonstrate the SpinnerUse ArrayAdapter to store the courses list. Create a single MainActivity that contains the spinner and on clicking any item of spinner Toast with that course name will be shown. Creating the activities: There will be one activity and hence one XML file for MainActivity. activity_main.

What is context menu android?

A context menu is a floating menu that appears when the user performs a long-click on an element. It provides actions that affect the selected content or context frame.


1 Answers

They've updated material design library:

<com.google.android.material.textfield.TextInputLayout     style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:hint="@string/hint_text">    <com.google.android.material.textview.MaterialAutoCompleteTextView       android:id="@+id/filled_exposed_dropdown"       android:layout_width="match_parent"       android:layout_height="wrap_content"/>  </com.google.android.material.textfield.TextInputLayout> 

This is the link: https://material.io/develop/android/components/menu/

like image 101
Jimmy Alvarez Avatar answered Nov 10 '22 00:11

Jimmy Alvarez