Chintan Soni Chintan Soni - 5 months ago 67
Android Question

Set some space inside editText

Can I set some space inside 'EditText' in the beginning and at the end? If possible, then how? Actually, I have done some customization on my 'EditText' view and now it shows like this, as shown in the below image:

Emulator screen shot

In my case, as you see, in my "description" field, the word "Description" starts from the very beginning, which doesnt look attractive, I want to keep some space in the beginning and at the end of the EditText's text. And also i want to set this, at the run time as this editText views are set on the runtime after a selection from the spinner. Can i achieve this?

Answer Source

Use padding left like

editText.setPadding (int left, int top, int right, int bottom);

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download