No need to create this effect manually on focus.
android:hint xml attribute is there for the effect you want.
You do not need to write a single line of code.

======================================
<EditText
android:layout_width="100dip"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:hint="Password"  />
======================================

http://developer.android.com/reference/android/widget/TextView.html#attr_android:hint

Regards
Sarwar Erfan


On Nov 23, 3:49 pm, umakantpatil <umakantpat...@gmail.com> wrote:
> Hi..
> I want to show edittext which will default show faint color text
> written as "Password". As soon as user focus on it then I want to
> convert it from text to password type. I did that but its not
> working..
>
> On focus of the password box. I wrote as follows:
>
>                                         EditText tpassword = (EditText) v;
>
>                                         
> tpassword.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
>                                         
> tpassword.setTextColor(getResources().getColor(R.color.black));
>                                         tpassword.setText("");
>
> Here it changes from grey color to black. All text is also cleared.
> But it doesn't change to password type. Is this allowed to change
> dynamically input type ?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to