Expanding button to x,y positions

[亡魂溺海] 提交于 2019-12-13 03:50:03

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!