0

What I'm trying to do:

i have a RecyclerView and i want to behave in such a way that when its pulled, a view becomes visible above it. Telegram App is a really good example of this.

enter image description here

More details:

1.the view should have animation when it's becoming visible, slowly expanding while the user is pulling the recyclerview

2.the view should become invisible when recyclerview is scrolled down.

My Code:

XML code of the fragment that contains the view and the recyclerview:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:animateLayoutChanges="true"
    android:layout_height="match_parent"
    android:id="@+id/relativelayout_story_library_main_layout"
    tools:context=".fragment.StoryLibraryFragment">
    <View
        android:visibility="gone"
        android:id="@+id/test_view"
        android:layout_width="match_parent"
        android:layout_height="@dimen/_60sdp"/>
    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/recyclerview_story_library"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="12dp"
        android:layout_marginTop="5dp"
        android:layout_marginEnd="12dp"
        android:overScrollMode="never"
        android:layout_below="@id/test_view"
        />
</RelativeLayout>


I don't think any other code is needed, if not please say so in the comments so i add the required code.

What I've tried:

i tried to use RecyclerViewBouncy for this effect. i used a ScrollListener to get the amount of pulling user is doing to dynamically set the height of the view. but it was too messy and it didn't work properly.

how can I achieve this? if you know any guide please share, even a clue would suffice :)

Anthraxff
  • 148
  • 1
  • 13
  • 1
    Someone has already done it using [Item Decoration](https://stackoverflow.com/a/33458426/15298643) – javdromero Mar 15 '21 at 20:07
  • what you are referring to is a parallax effect, what I'm trying to do is kind of different because user needs to pull to make the ```view``` visible – Anthraxff Mar 16 '21 at 15:48

0 Answers0