使用TextInputLayout.OutlinedBox样式的材质设计微调器 [英] Material design Spinner using TextInputLayout.OutlinedBox styling

本文介绍了使用TextInputLayout.OutlinedBox样式的材质设计微调器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用Material Design TextInputLayout OutlinedBox,如下所示:

I am currently using Material Design TextInputLayout OutlinedBox as shown below:

        <android.support.design.widget.TextInputLayout
            style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <android.support.design.widget.TextInputEditText
                android:id="@+id/myEditText"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="Title"
                android:inputType="text"/>

        </android.support.design.widget.TextInputLayout>

我试图在我的TextInputEditText下添加一个下拉框Spinner,并希望保持相同的样式:OutlinedBox.

I am trying to add a dropdown box Spinner under my TextInputEditText, and would like to keep the same styling: OutlinedBox.

我看到材料设计似乎支持下拉菜单,材料设计文本字段.如此处的区域所示:

I see that dropdowns seem to be supported in Material Design, Material Design Text Fields. As shown on here for the Area:

我目前正在使用微调框来生成下拉列表.

I am currently using a Spinner to generate the Dropdown.

        <Spinner
            style="@style/Widget.AppCompat.Spinner.DropDown"
            android:id="@+id/option"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:dropDownWidth="match_parent" />

似乎无法在OutlinedBox设计之后添加下拉列表.是否有一个可以让我实现这一目标的库,还是在Material Design中实现此目标的更好方法?

It doesn't seem possible to add a dropdown following the OutlinedBox design. Is there a library out there that would allow me to make this happen, or is there a better way to implement this within Material Design?

推荐答案

我认为该文档根本没有显示Spinner.我认为它显示的是带有下拉图标的TextInputLayout.

I believe that this document isn't showing a Spinner at all. I think it's showing a TextInputLayout with a dropdown icon.

解剖"部分的图标"子部分中,它说

In the Anatomy section, at the Icons subsection, it says

5.下拉图标

下拉箭头表示文本字段具有嵌套的选择组件.

A dropdown arrow indicates that a text field has a nested selection component.

现在,如何您不确定我提供的嵌套选择组件" ...

Now, how you provide the "nested selection component" I'm not sure...

这篇关于使用TextInputLayout.OutlinedBox样式的材质设计微调器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆