【问题标题】:How can we write text on EditText Border? [duplicate]我们如何在 EditText 边框上写文字? [复制]
【发布时间】:2019-12-26 17:41:28
【问题描述】:

我们如何在android中实现这些东西?

EditText 在 Border 上的 InputText?

【问题讨论】:

  • 这可以使用google提供的材料库来实现。在此链接上查找更多详细信息 - material.io/design/components/…
  • 简单地将轮廓框样式应用到 TextInputLayout by style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"

标签: android android-edittext material-design android-textinputedittext material-components-android


【解决方案1】:

使用TextInputLayout

<com.google.android.material.textfield.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="@string/hint_text">

  <com.google.android.material.textfield.TextInputEditText
      android:layout_width="match_parent"
      android:layout_height="wrap_content"/>

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

并应用这种风格:

style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-10-15
    • 2017-05-15
    • 1970-01-01
    • 1970-01-01
    • 2011-09-25
    • 1970-01-01
    • 2014-01-31
    • 1970-01-01
    相关资源
    最近更新 更多