Skip to content

Instantly share code, notes, and snippets.

@maxwellnewage
Created December 13, 2015 03:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxwellnewage/cc556a9a2dde7fb7f7d1 to your computer and use it in GitHub Desktop.
Save maxwellnewage/cc556a9a2dde7fb7f7d1 to your computer and use it in GitHub Desktop.
//method for move a button on the screen (min API 19)
public void moveButton(){
View buttonAnimation = findViewById(R.id.buttonAnimation);
TransitionManager.beginDelayedTransition(rlAnimation);
RelativeLayout.LayoutParams positionRules = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT);
positionRules.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
positionRules.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
buttonAnimation.setLayoutParams(positionRules);
ViewGroup.LayoutParams sizeRules = buttonAnimation.getLayoutParams();
sizeRules.width = 450;
sizeRules.height = 300;
buttonAnimation.setLayoutParams(sizeRules);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment