Skip to content

Repository files navigation

Tinder like ANDROID stretch top ScrollView

or just

Pull to zoom:

This is a Tinder like android Stretch Top ScrollView / pull to zoom custom View.. The Examples show you how can you use this type of view

Gifs:

Alt TextAlt Text

Usage for a top ImageView in xml:

<?xmlversion="1.0" encoding="utf-8"?><hu.lacroix82.stretchtopviewlibrary.StretchTopScrollView xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:id="@+id/stretchTopView"
>
<LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"
>
<ImageViewandroid:layout_width="match_parent"android:layout_height="200dp"android:id="@+id/topView"android:src="@drawable/img1"android:scaleType="centerCrop"
/>
<includelayout="@layout/view_bottom" />
</LinearLayout>
</hu.lacroix82.stretchtopviewlibrary.StretchTopScrollView>

Usage for a top ViewPager in xml:

<?xmlversion="1.0" encoding="utf-8"?><hu.lacroix82.stretchtopviewlibrary.StretchTopScrollView xmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/stretchTopView"android:layout_width="match_parent"android:layout_height="match_parent">
<LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical">
<FrameLayoutandroid:layout_width="match_parent"android:layout_height="400dp"android:id="@+id/topView"
>
<android.support.v4.view.ViewPagerandroid:layout_width="match_parent"android:layout_height="match_parent" />
<com.viewpagerindicator.CirclePageIndicatorandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center|bottom"android:layout_marginBottom="20dp"android:id="@+id/indicator"
/>
</FrameLayout>
<includelayout="@layout/view_bottom" />
</LinearLayout>
</hu.lacroix82.stretchtopviewlibrary.StretchTopScrollView>

after just use in code:

stretchTopView.setFactor(1.7f);
stretchTopView.setChangeListener(newStretchTopScrollView.onOverScrollChanged() {
@OverridepublicvoidonChanged(floatfactor) {
descriptionTextView.setAlpha(factor);
}
});

.setFactor(float v) : a float factor for the stretch, between 1.0f and maybe 2.0f, optional, default is 1.6f

.setChangeListener(...) : a simple callback that can return the animated factor in a float : 0-100%, between 0f and 1f

Author:

created by Kozári László

License:

Copyright 2016 Kozári László

Licensed under the Apache License, Version 2.0 (the "License")

About

This is an Android Tinder like Stretch Top ScrollView custom View!

Resources

Stars

58 stars

Watchers

4 watching

Forks

Releases

Packages

Contributors

Languages