EditText提示属性不起作用

时间:2016-04-07 06:31:20

标签: android android-edittext hint

当我在标签布局中使用数据绑定库时,EditText提示在输入后不会隐藏。

<layout> <Edittext hint='enter your text'/> <layout>

4 个答案:

答案 0 :(得分:1)

试试这段代码

     <EditText
            android:id="@+id/reg_edu_edittext"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:inputType="textPersonName"
            android:hint=" Educational Qualification"
            android:layout_marginTop="5dp"/>

答案 1 :(得分:0)

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

        <EditText
            android:hint="Caption..."
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textColor="#ffffff"
            android:textSize="20sp"/>
</RelativeLayout>

答案 2 :(得分:-1)

请尝试以下代码:

<layout>
<data>
    <variable
        name="user"
        type="com.project.User" />
</data>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <EditText
        android:id="@+id/phone_number"
        android:text="@{user.userName}"
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:hint="phone number" />
</LinearLayout>

答案 3 :(得分:-1)

这个链接可以帮助你在Edittext中添加提示,并且当用户使用EditText提示颜色样式输入内容时,你将获得删除它的代码。 检查..

Android EditText Hint