android – 如何使用浮动文本自定义微调器

我想使用浮动文本自定义Spinner,如带有浮动标签的EditText.请查看下面的参考图片:

现在我想把一个TextView放在Spinner上面,使它看起来像在图像中.如果我错了或者有任何不同的意见请帮助我.

UPDATE

解决方案:使用以下库在pre-lollipop上使用材质主题
https://github.com/rey5137/material

最佳答案 正如我在
this answer
my own question所写的……

I have created a compound View component which displays a label above the Spinner. 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 the TextInputLayout component.

I have named it a 07002, and it is available as part of my 07003 Android library on GitHub under the 07004.

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).

点赞