如何在android中做webview动画

发布于 2024-12-07 11:50:01 字数 146 浏览 1 评论 0原文

假设我有三个文本作为标题。您可以如何获取文本视图或任何内容。左侧一个文本,一个中间一个文本,一个右侧文本。所以当我向左滑动屏幕时,我想要一个动画,然后左侧文本就会消失,中心文本将位于左侧,右侧文本将位于中心。右侧幻灯片也是如此。任何人都可以建议我如何实现这种类型的动画。请帮忙。

suppose i have three text as heading.Any how you can take textview or anything.one text on left,one in center and one in right side.so i want an animation when i will slide the screen left then left text will be gone,center text will come to left and right text will come to center.Same thing for right slide.Can anyone suggest how can i achieve this type of animation.Plz help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泅渡 2024-12-14 11:50:01

您可以尝试创建一个动画变量:

  private Animation leftAnimation() {

        Animation outtoLeft = new TranslateAnimation(
                Animation.RELATIVE_TO_SELF, 0.0f,
                Animation.RELATIVE_TO_SELF, 0.0f,
                Animation.RELATIVE_TO_SELF, 1.0f,
                Animation.RELATIVE_TO_SELF, 0.0f);
        outtoLeft.setDuration(500);
        outtoLeft.setInterpolator(new AccelerateInterpolator());
        return outtoLeft;
    }

然后
将此操作设置为您的框架:

public void onLeftArrowClick(View v) {
        frame.setAnimation(moveComingSoonToBottomAnim); // your Frame variable
        animVariable.startNow();// your anime variable
        frame.setVisibility(View.VISIBLE);
        rightFrame.setVisibility(View.GONE); // hide your right text view
    }

You can try to create an animation variable :

  private Animation leftAnimation() {

        Animation outtoLeft = new TranslateAnimation(
                Animation.RELATIVE_TO_SELF, 0.0f,
                Animation.RELATIVE_TO_SELF, 0.0f,
                Animation.RELATIVE_TO_SELF, 1.0f,
                Animation.RELATIVE_TO_SELF, 0.0f);
        outtoLeft.setDuration(500);
        outtoLeft.setInterpolator(new AccelerateInterpolator());
        return outtoLeft;
    }

then
set this action to your frame:

public void onLeftArrowClick(View v) {
        frame.setAnimation(moveComingSoonToBottomAnim); // your Frame variable
        animVariable.startNow();// your anime variable
        frame.setVisibility(View.VISIBLE);
        rightFrame.setVisibility(View.GONE); // hide your right text view
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文