小编Him*_*bra的帖子

Android TextInputLayout提示与EditText提示重叠

我面临一个奇怪的问题,我有一个InputTextLayout和一个EditText,并且我正在尝试实现类似的功能(如下图所示)(来自材料设计指南的图像:https : //material.io/guidelines/components /text-fields.html#text-fields-layout),其中有两个单独的提示。我这样做是通过将android:hint添加到两个布局中。这可以正常工作,但是当焦点移开该位置时,“标签”将向下移动并与“占位符”文本重叠。(仅当用户未提供任何输入且编辑文本为空时,两个提示才重叠)。关于如何解决此问题的任何指示?

作为一项要求,我需要两个提示都存在,并且“标签”不应向下移至焦点更改。两种提示都应保持在原位

 <android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Label">

        <android.support.v7.widget.AppCompatEditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Placeholder"
            android:inputType="textCapWords"
            />

    </android.support.design.widget.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

android android-layout android-edittext android-textinputlayout textinputlayout

6
推荐指数
3
解决办法
4353
查看次数