I have a question about EditText in Android. How can I set the hint align center but text align left? Thanks a lot.
I just want to make the cursor locate at left and hint center in EditText
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can do it programmatically, in Java code. For example:
Don’t miss a word ‘final’. It makes your textView visible in the listener code.
Instead of ‘final’ keyword you can cast `View v` into the `TextView` in the ‘onKey’ method.
Updated 9 March 2012:
In such a case, you can remove `onKeyListener` and write `onFocusChangeListener`
Here is some code: