Reputation: 3
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);
Upvotes: 0
Views: 1388
Reputation: 765
When you change the background, the padding is reset. This is the default behaviour. You can find more about this: here and here
Upvotes: 5