I would like to set a background drawable (or resource) on a TextView, not taking into account its compound drawable width (and paddings).
Getting the width of the compound (left one to be more precise), and its paddings should not be a problem, but the setting of the background on the width of the textview minus the width of the compound drawable (described above).
Should you have any advice on doing that, please let me know.
PS. I thought about having a horizontal LinearLayout with an ImageView and TextView as its children, and having the background set on the textview only, but I am interested in having the same result with less Views (in this case, exactly one), if it is possible.

You could use a LayerDrawable which supports insets, for example:
If you want to change your Drawable dynamically you're better off writing your own Drawable class. The following DividerDrawable for instance draws a line to a given padding onto a white background:
To set the left padding based on your left CompoundDrawable you could do something like this:
To make good use of all this call it like so: