Q:

Set padding for textview works only after setting background resource - Android

Setting the background resource to a drawable xml for a textview after setting its padding doesn't pad the textview, but vice versa works. How ?
Example
works
   textView.setBackgroundResource(borderColor);
   textView.setPadding(10, 0, 10, 0);

doesn't work
   textView.setPadding(10, 0, 10, 0);
   textView.setBackgroundResource(borderColor);

A:

When you change the background, the padding is reset. This is the default behaviour.
You can find more about this:
here
and 
here

