问题
Here are my two buttons: http://prntscr.com/hos2hz (Ignore the dotted line)
I want the GREEN button to expand with an animation to fill the whole of the view (highlighted in red): http://prntscr.com/hos3hm
If the answer could be programmatically, rather than XML, that would be fantastic.
I would imagine it would be something to do with expanding to its parent view, or more likely to an X,Y,Width,Height position, but I'm not quite sure.
All help is greatly appreciated :)
回答1:
You can do something like this
TransitionManager.beginDelayedTransition(parent);
RelativeLayout.LayoutParams parms = (RelativeLayout.LayoutParams) child.getLayoutParams();
parms.height = RelativeLayout.LayoutParams.MATCH_PARENT;
parms.width = RelativeLayout.LayoutParams.MATCH_PARENT;
child.setLayoutParams(parms);
来源:https://stackoverflow.com/questions/47859048/expanding-button-to-x-y-positions