Last active
June 18, 2016 07:43
-
-
Save mahdimortazavi/5956ca3ea0be2cf5ddb6548d5aabd0ac to your computer and use it in GitHub Desktop.
margin and background color for Button
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
Button button=(Button)findViewById(R.id.button); | |
Button button2=(Button)findViewById(R.id.button2); | |
button.setBackgroundColor(getResources().getColor(R.color.grey_100)); | |
button2.setBackgroundColor(getResources().getColor(R.color.grey_100)); | |
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) button.getLayoutParams(); | |
params.leftMargin=7; | |
params.rightMargin=7; | |
ViewGroup.MarginLayoutParams params2 = (ViewGroup.MarginLayoutParams) button2.getLayoutParams(); | |
params2.leftMargin=7; | |
params2.rightMargin=7; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment