拉缩放动画缩放、动画

2023-09-05 00:21:05 作者:你是人间四月天

我们很多人一定都遇到过应用程序,如 火绒 和 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