将按钮扩展到x,y位置 [英] Expanding button to x,y positions

查看:82
本文介绍了将按钮扩展到x,y位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的两个按钮: http://prntscr.com/hos2hz (忽略虚线)

Here are my two buttons: http://prntscr.com/hos2hz (Ignore the dotted line)

我希望GREEN按钮可以用动画扩展以填充整个视图(以红色突出显示): http://prntscr.com/hos3hm

I want the GREEN button to expand with an animation to fill the whole of the view (highlighted in red): http://prntscr.com/hos3hm

如果答案可以是编程方式而不是XML,那就太好了.

If the answer could be programmatically, rather than XML, that would be fantastic.

我想这可能与扩展到其父视图,或更可能是扩展到X,Y,Width,Height位置有关,但我不太确定.

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.

非常感谢所有帮助:)

推荐答案

您可以执行以下操作

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);

这篇关于将按钮扩展到x,y位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆