You cannot set the correct fill / margin at intervals. But you can cheat with MetricAffectingSpan . It has two methods: updateMeasureState (called when measuring text) and updateDrawState (called when drawing text).
So, if you increase the value of textScaleX when measuring, android will make short lines. If you do not increase textScaleX when drawing, android will not scale the lines when drawing. As a result, you will get shorter lines. It will look like the right addition.
This is not ideal: you cannot set the correct padding in pixels, but you will have some padding on the right.
Here is an example of a 5% correct fill.
public class RoughtRightPaddingSpan extends MetricAffectingSpan { @Override public void updateMeasureState(TextPaint p) { p.setTextScaleX(1.05f); } @Override public void updateDrawState(TextPaint tp) { } }
source share