gpt4 book ai didi

java - 总是在 edittext 上方设置 textinputlayout 的提示?

转载 作者:行者123 更新时间:2023-11-29 02:39:29 25 4
gpt4 key购买 nike

如何将 TextInputlayouthint 设置为始终在 EditText 之上?这意味着我不必单击 EditText 使其向上滑动。现在,EditText 提示和TextInputLayout 提示重叠,我希望它们分开!

我当前的 XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/relativeID"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.v7.widget.RecyclerView
android:id="@+id/messageRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<android.support.design.widget.TextInputLayout
android:id="@+id/inputLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="My Hint Text"
app:hintEnabled="true"
app:hintAnimationEnabled="false">

<EditText
android:hint="Type here"
android:id="@+id/messageEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>

</android.support.design.widget.TextInputLayout>

</LinearLayout>

</RelativeLayout>

最佳答案

InputText 布局的主要功能是 float 编辑文本、密码切换和错误可见。

因此,如果您想要在 edittext 上方提示,请使用一个 textview 并在其下方设置 edittext。

如果您不想要它提供的确切行为,请不要使用 TextInput 布局。

关于java - 总是在 edittext 上方设置 textinputlayout 的提示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45235198/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com