首页 > 解决方案 > 如何制作这种类型的自定义 EditText UI?

问题描述

我正在尝试在编辑文本上添加边框并在其上添加标签。我试过这个。在此处输入图像描述

<stroke
    android:width="2dp"
    android:color="@color/colorPrimary"/>
<corners android:radius="15dp"/>

但我想要以下一个。最初它看起来像这样。在此处输入图像描述

点击后会是这个样子。 在此处输入图像描述

你能帮忙吗?

标签: androiduser-interfaceandroid-edittext

解决方案


使用材料设计 Outline Box style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"

这个链接可以帮助你http://qaru.site/questions/1688917/custom-textinputlayout-android


推荐阅读