Android 绝对布局/参数(在运行时移动小部件)
因此,对于我正在开发的项目,我需要能够在运行时将小部件移动到屏幕上(就像反向瀑布一样)。有人可以展示一个如何在运行时将按钮从屏幕的一个位置移动到更高位置(使用绝对布局)的示例吗?
我知道它可能希望使用
AbsoluteLayout.LayoutParams
params.addRule 。但请务必教我
例如:
_____________________(屏幕顶部)
| [按钮]
| -
| -
| -
| -
| -
| -
| -
| >
| [按钮]
_____________________(屏幕底部)
So for the project I'm working on I need to be able to move widgets up the screen during runtime (like a reverse waterfall). Could someone please show an example of how to move a button from one position of the screen to a higher position (using an absolute layout) during runtime?
I know it probably makes use of
AbsoluteLayout.LayoutParams
or params.addRule
hopefully. But please do care to teach me
For Example:
_____________________(Top Of Screen)
| [button]
| -
| -
| -
| -
| -
| -
| -
| >
| [button]
_____________________(Bottom Of Screen)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自 http://developerlife.com/tutorials/?p=343
这是一个幻灯片-左动画(在视图的宽度上从右向左平移),名为“/res/anim/slide_right.xml”:
这是使用上面动画序列的另一个动画序列(@anim/slide_right.xml ->“/ res/anim/slide_right.xml”):
因此您可以在 XML 中创建序列并将它们放入 Android 项目资源的“/res/anim/some_file.xml”中。您可以在此处获取有关如何创建此 XML 文件的更多详细信息。
您也可以通过代码:: 来完成此操作,
然后:
From http://developerlife.com/tutorials/?p=343
Here’s a slide-from-left animation (translate from right to left across the width of the view), named “/res/anim/slide_right.xml”:
Here’s another animation sequence that uses the one above (@anim/slide_right.xml -> “/res/anim/slide_right.xml”):
So you can create your sequences in XML and put them in the “/res/anim/some_file.xml” of your Android project resources. You can get more details on how to create this XML file here.
You can also do this by code::
and then: