I have a textview which holds an image and some text.
programmatically i have added the drawable image to the left side of text view
txtIDFav.setCompound
You have to write code like this:-
txtIDFav.setGravity(Gravity.CENTER | Gravity.RIGHT);