TextInputLayout后缀/前缀 [英] TextInputLayout suffix/prefix

查看:86
本文介绍了TextInputLayout后缀/前缀的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在TextInputLayout中添加后缀.例子来自 材料组件库中提供的你可以使用的属性:

  • app:prefixText :前缀文本
  • app:suffixText :后缀文字

类似的东西:

 < com.google.android.material.textfield.TextInputLayoutandroid:hint ="测试"app:prefixText =" @string/...& quot;app:prefixTextColor =" @ color/secondaryDarkColor"app:suffixText =" @string/...& quot;app:suffixTextColor =" @ color/primaryLightColor"...>< com.google.android.material.textfield.TextInputEditText.../></com.google.android.material.textfield.TextInputLayout> 

示例:

注意:这要求最低版本为 1.2.0-alpha01 .

I want to add suffix to TextInputLayout. An example is taken from the material.io

Are there any standard solutions?

解决方案

With the TextInputLayout provided in the Material Components Library you can use the attrs:

  • app:prefixText: prefix text
  • app:suffixText: suffix text

Something like:

<com.google.android.material.textfield.TextInputLayout
    android:hint="Test"
    app:prefixText="@string/..."
    app:prefixTextColor="@color/secondaryDarkColor"
    app:suffixText="@string/..."
    app:suffixTextColor="@color/primaryLightColor"
    ...>

    <com.google.android.material.textfield.TextInputEditText
        .../>

</com.google.android.material.textfield.TextInputLayout>

Example:

Note: This requires a minimum of version 1.2.0-alpha01.

这篇关于TextInputLayout后缀/前缀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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