2016-04-07 26 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"/>