This is most simple question that may a new guy will asked and googling. When we create folder “drawable” in “/res” and put several xml / images in there, we can accessed it from views.
To access it, we use
1 | Android.R.drawable.<your-XML-or-Images> |
Eg :
1 2 | /res/drawable/search.xml /res/drawable/search_progress.xml |
We want to change our EditText which use search.xml by default into search_progress.
Then we can do by :
1 2 | EditText search = (EditText) this.findViewById(R.id.searchbox) search.setBackgroundResource(R.drawable.search_progress); |
This will change background search which use search.xml on default into search_progress.xml.