拉缩放动画 [英] Pull to Zoom Animation

查看:147
本文介绍了拉缩放动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们很多人一定都遇到过应用程序,如 火绒 <一个href="https://play.google.com/store/apps/details?id=com.drippler.android.updates">Dripper在这里,你可以拉下包含图像的观点和图像放大。然后,当你让它去,图像缩小回到其原籍国家。

Many of us must have come across apps like Tinder and Dripper where you can pull down on the view containing an image and the image zooms in. And then when you let it go, the image zooms out to go back to its origin state.

让我们从火种的例子:

原始状态:放大的状态拉升时:

的iOS 它是由

- (void)viewDidLoad {
    [super viewDidLoad];

    self.imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"church-welcome.png"]];
    self.imageView.contentMode = UIViewContentModeScaleAspectFill;
    self.cachedImageViewSize = self.imageView.frame;
    [self.tableView addSubview:self.imageView];
    [self.tableView sendSubviewToBack:self.imageView];
    self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 170)];

}

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {

    CGFloat y = -scrollView.contentOffset.y;
    if (y > 0) {
        self.imageView.frame = CGRectMake(0, scrollView.contentOffset.y, self.cachedImageViewSize.size.width+y, self.cachedImageViewSize.size.height+y);
        self.imageView.center = CGPointMake(self.view.center.x, self.imageView.center.y);
    }

}

由于我在Objective C和iOS的专业知识是非常有限的,我不能够在Android中实现它。

Since my expertise in Objective C and iOS is very limited, I am not being able to implement it in Android.

下面是我认为应该做的:

Here is what I think should be done :

  • 赶上下拉手势
  • 通过牵拉量增加视图的高度
  • 在做某种规模的动画对图像中的扩展视图,以适应它

没有人有任何想法,如果有可能被用于此目的的库?

Does anyone have any idea if there is any library that could be used for this purpose?

推荐答案

看看这个项目:

https://github.com/Gnod/ParallaxListView

如果你用ViewPagerIndicator库结合起来,你pretty的多少获得火种的个人资料页面功能集

If you combine it with the ViewPagerIndicator library, you pretty much get Tinder's profile page feature set

https://github.com/JakeWharton/Android-ViewPagerIndicator

这篇关于拉缩放动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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