gkn06
gkn06

Reputation: 95

How to change EditText look programmatically?

I want to change default edittext look(Image:Look which i need to change) from box like look(Image:Look whic i need)... This must be done programmatically,...I dont know how to do this...please help me

Look which i need to change

Look which i needed

Edit : Sorry typed the title wrong

Edit:Why this is not a useful question?? who voted this question down...anybody please fix this by voting up...I cant post questions

Upvotes: 1

Views: 578

Answers (2)

I would create a 9patch image and then set the background drawable programmatically. Please look at this tutorial and see if it's of any help.

http://wptrafficanalyzer.in/blog/changing-background-color-and-border-color-of-an-edittext-widget-using-state-list-in-android/

EDIT: doing a little more research I've found that you can get the desired look&feel by just creating a shape in drawable.xml file. You can find some samples here: http://letustech.wordpress.com/2012/09/16/customedittext/ ... then just call setBackgroundResource on the EditText to set it programmatically.

Upvotes: 1

Niza Siwale
Niza Siwale

Reputation: 2404

Create a 9 patch drawble and use that as your background.Call setBackDrawable() to use it

Upvotes: 0

Related Questions