EditText提示属性不起作用



当我在选项卡布局中使用数据绑定库时,EditText提示在键入后不会隐藏。

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

试试这个代码

<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" />
<?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>

尝试以下代码:

<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>

这个链接将帮助您在Edittext中添加提示,当用户在其中输入具有Edittext提示颜色样式的内容时,u也将获得删除提示的代码。检查一下…

Android编辑文本提示

最新更新