当第一个按钮变为可见时,如何移动另一个按钮。 [英] How to shift another button when first button becomes visible.

查看:89
本文介绍了当第一个按钮变为可见时,如何移动另一个按钮。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用程序,其中有两个按钮说Button1和Button2,Button2只出现在某些特殊情况下,我想要做的是当Button2出现时Button1应该改变它的位置,即它应该转移到一边屏幕,任何想法或帮助实现这一点将不胜感激。谢谢。

i am developing an application in which there are two buttons say Button1 and Button2,Button2 appears only in some special condition,what i am trying to do is when Button2 appears Button1 should change its position,ie it should be shifted to side of the screen,any idea or help to achieve this will be greatly appreciated.Thanks.

推荐答案

您可以尝试使用 setLayoutParams [ ^ ]方法按钮 [ ^ ]。



创建AbsoluteLayout [ ^ ]具有所需尺寸和坐标的对象。

You can try using the setLayoutParams[^] method of the button[^].

Create an AbsoluteLayout[^] object with the dimension and coordinates you want.
AbsoluteLayout.LayoutParams layout = new AbsoluteLayout.LayoutParams(width, height, xPosition, yPosition);

并用它来设置按钮的新位置

and use it to set the new position of the button

Button1.setLayoutParams( layout );


这篇关于当第一个按钮变为可见时,如何移动另一个按钮。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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