Created
September 17, 2014 02:01
-
-
Save billynyh/d949d233c6f313271182 to your computer and use it in GitHub Desktop.
keep view's padding when changing 9patch background
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void setBackgroundResource(View v, int id) { | |
int bottom = v.getPaddingBottom(); | |
int top = v.getPaddingTop(); | |
int right = v.getPaddingRight(); | |
int left = v.getPaddingLeft(); | |
v.setBackgroundResource(id); | |
v.setPadding(left, top, right, bottom); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment