In the xml you can set a drawable to the left, right, bottom or top of the text in TextView. Is there a way to set / change this drawable through a code?
Asked
Active
Viewed 1.7k times
1 Answers
68
TextView textView = (TextView)findViewById(R.id.myTxtView);
textView.setCompoundDrawablesWithIntrinsicBounds(
R.drawable.icon, //left
0, //top
0, //right
0);//bottom

Andrew M.
- 9
- 1
- 4

Ram kiran Pachigolla
- 20,897
- 15
- 57
- 78
-
1good answer, but my app must support right to left languages, so i need use start instead of left, could you help me please. – Heysem Katibi Jun 05 '13 at 11:07
-
1