After I call the setCompoundDrawables method, the compound Drawable is not shown..
Drawable myDrawable = getResources().getDrawable(R.drawable.btn);
btn.setC
The Image is not shown as you didn't specify the bounds, so you have 2 options here.
1st Method
Use setCompoundDrawablesWithIntrinsicBounds method, as shown below
Drawable myDrawable = getResources().getDrawable(R.drawable.btn);
btn. setCompoundDrawablesWithIntrinsicBounds(myDrawable, null, null, null);
2nd Method
You can apply bounds to the drawable before applying to the TextView, as shown below
Drawable myDrawable = getResources().getDrawable(R.drawable.btn);
myDrawable.setBounds( 0, 0, myDrawable.getIntrinsicWidth(), myDrawable.getIntrinsicHeight());
btn.setCompoundDrawables(myDrawable, null, null, null);
That's it.