After some more research, the only way I was able to solve this, is to create an intermediary Drawable (man in the middle) and delegate all public methods to the actual Drawable. Then override setBounds
to set whatever value I want...
public class MyCustomView extends EditText {
@Override
public void setBackground(Drawable background) {
super.setBackground(new IntermediaryDrawable(background));
}
...
private class IntermediaryDrawable extends Drawable {
private Drawable theRealDrawable;
public IntermediaryDrawable(Drawable source) {
theRealDrawable = source;
}
@Override
public void setBounds(int left, int top, int right, int bottom) {
theRealDrawable.setBounds(left, 100, right, bottom);
}
...
}
}
Pretty hacky. If anyone comes across this with a better solution, please share.