gpt4 book ai didi

java - Android-按钮滑动效果

转载 作者:太空狗 更新时间:2023-10-29 15:42:04 25 4
gpt4 key购买 nike

我想在屏幕一侧的箭头上有一个滑动效果。当我单击箭头时,将显示一个带有滑动效果的按钮。我不确定我该怎么做。

我想我可以在这个上使用嵌入式 fragment ,但我不知道如何实现幻灯片效果。

enter image description here

最佳答案

这是实现此目的的代码。我也写了评论。

TranslateAnimation anim = new TranslateAnimation(0, 150, 0, 0); //first 0 is start point, 150 is end point horizontal
anim.setDuration(1000); // 1000 ms = 1second
yourarrow.startAnimation(anim); // your imageview that you want to give the animation. call this when you want it to take effect

如果你想让它在动画结束后保持那样,放这个:

anim.setFillAfter(true);

关于java - Android-按钮滑动效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17876179/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com