2016-04-07 29 views
-12

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

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

分享您的布局代码 –

+1

发表您的XML请 –

+0

@chavantr你能够基于下面的答案来解决问题了吗? –

回答

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

感谢您的建议,但不是为我工作,我已经试过这个解决方案 – chavantr

+0

@chavantr请发布您的XML布局,我会帮你 –

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

+0

谢谢你的建议尝试所有的东西但不起作用 – chavantr

+0

你可以发布你的XML文件吗?这样可以帮助您找到确切的问题。 – Mrunal

+0

解决了一个问题,谢谢 – chavantr

-1

可能这个链接将帮助您在EDITTEXT添加提示,并U将得到代码当用户在输入内容中删除它带有EditText提示颜色样式。 检查它..

Android EditText Hint

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