I want to customize Spinner
with a floating text like in EditText
with floating label. Please check the reference image below:
Now I am thinking to put a TextView
just above Spinner
so that it looks like in the image. If I am wrong or anybody have different opinion please help me.
UPDATE
Solution: Use following library to use material theme on pre-lollipop https://github.com/rey5137/material
As I wrote in this answer to my own question...
I have created a compound
View
component which displays a label above theSpinner
. The text for the label can be set using XML or in Java.The component has the key features of a
Spinner
(not all of them) as well as looking similar to theTextInputLayout
component.I have named it a
LabelledSpinner
, and it is available as part of my UsefulViews Android library on GitHub under the Apache 2.0 License.To use it, add the library dependency in your
build.gradle
file:
compile 'com.satsuware.lib:usefulviews:+'
Examples of its usage are available at the GitHub repository (both a sample app, and a usage guide).