我想用文本输入布局制作一个寄存器片段。但是我的问题是提示属性。键入时,提示的副本将上升。键入时有两个提示。活动页面中也没有此问题。我该如何解决这个问题?
<android.support.design.widget.TextInputLayout
android:id="@+id/floating_hint_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hintTextAppearance="@style/FloatingHintStyle">
<EditText
android:id="@+id/etEmail"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:ems="10"
android:hint="Emailinizi giriniz"
android:inputType="textEmailAddress" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/floating_hint_pass"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hintEnabled="true"
app:hintTextAppearance="@style/FloatingHintStyle">
<EditText
android:id="@+id/editText2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Şifrenizi giriniz"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
答案 0 :(得分:0)
您需要使用TextInputEditText
而不是EditText
,您的代码应类似于
<android.support.design.widget.TextInputLayout
android:id="@+id/floating_hint_email"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/etEmail"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:ems="10"
android:hint="Emailinizi giriniz"
android:inputType="textEmailAddress" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/floating_hint_pass"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/editText2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Şifrenizi giriniz"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>