android - Material Design 中的大纲编辑文本
问题描述
我怎样才能实现一个概述的文本字段(如这个材料设计页面所示)?
解决方案
阅读Outline Box
。
大纲文本字段有一个描边边框并且不太强调。要使用大纲文本字段,请将以下样式应用于您的 TextInputLayout:
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
依赖项
implementation 'com.android.support:design:28.0.0-alpha1'
XML
<android.support.design.widget.TextInputLayout
android:id="@+id/name_text_input"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<android.support.design.widget.TextInputEditText
android:id="@+id/name_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/label_name" />
</android.support.design.widget.TextInputLayout>
供参考
旧版支持在 Android 28 中结束。现在继续使用
implementation 'com.google.android.material:material:1.3.0'
推荐阅读
- python - Python:修改和编辑函数内的数据框
- node.js - 如何付款 意图在 Stripe 中向已连接的帐户收费
- mysql - 有没有办法在 SQL 的左连接之后获取变量并将它们添加为列?
- javascript - 在 DOM 中搜索大于“x”的数字,然后附加带有差异的数字
- c# - 为什么我不能用这种模式删除“[restr=戸]”
- javascript - 无法在 Javascript async/await try/catch 客户端代码中访问 res.statusMessage 以读取从快速后端抛出的异常
- c# - .NET CORE 串行类在使用 tty 端口发布到 Linux 机器时未读取 BaseStream 或 ReadBuffer 中超过 4KBytes 的数据
- php - Jquery Ajax Post 再次返回数据
- ios - 为什么 WKWebView 不打开 target="_blank" 的链接?
- javascript - 如何定位用户并根据他们的语言显示页面