Android 表格行动画的过渡动画
我有一个桌行,只需按一下按钮,就会慢慢淡出并消失。为此,我使用了以下代码。
private TableRow topRow = (TableRow) findViewById(R.id.topRow);
.....
.....
topRow.startAnimation(AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.fade_out));
topRow.setVisibility(View.INVISIBLE);
在另一种情况下,该行必须缓慢下降(就像日落一样)并变得不可见。上面的代码有什么变化或者如何安排?
I have a tablerow which on a button touch, slowly fade out and go to invisible. For that I have used the following code.
private TableRow topRow = (TableRow) findViewById(R.id.topRow);
.....
.....
topRow.startAnimation(AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.fade_out));
topRow.setVisibility(View.INVISIBLE);
In another case, the row have to go down slowly(just like sunset) and become invisible. What change in the above code or how it is possible to arrange?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您想要一个淡出(缓慢降低 Alpha)并平移(向下移动行)的动画。这可以在动画 xml 资源文件中设置,如下所示:
然后您需要调用新动画(就像您在代码示例中所做的那样),但现在您需要它在动画开始之前可见。如果您将动画 xml 作为 Sunset.xml 存储在 /res/anim/ 文件夹中,您应该通过包含以下代码来实现您想要的效果:
You want an animation that fades out (slowly turns down the alpha) and translates (moves the row down). This can be set in an animation xml resource file like so:
You then need to call your new animation (as you do in your code sample already), but now you need it to be visible before the animation starts. If you store your animation xml in the /res/anim/ folder as sunset.xml you should achieve what you want by including this code: