I have a recycler view setup to display a list of contacts. The contacts are itself grouped according to initials. To manage the display of this, each recyclerview item, consists of a textView and a linearLayout. The textView holds the initial letter. And the LinearLayout holds the contacts starting with that letter.
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorGrayLight">
<TextView
android:id="@+id/itemRclContactsDisplayTvGroupLetter"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/_16sdp"
android:layout_marginEnd="@dimen/_16sdp"
android:layout_marginTop="@dimen/_8sdp"
android:onClick="@{clickHandler::contactGroupClicked}"
android:text="@{contactList.getGroupLetter()}"
android:textSize="@dimen/_16sdp"
android:textColor="@color/colorText1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="A" />
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/_8sdp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/itemRclContactsDisplayTvGroupLetter">
<LinearLayout
android:id="@+id/itemRclContactsDisplayLlContactContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" />
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
This is the code for the recycler-view item layout. Now what I need to achieve is that I need to Implement a search feature here, while the user searches, after inputting the search string and pressing the search button, the list will scroll the specific contact to top of the screen if it is found. The problem lies here, I am able to scroll the recycler-view itself. But that is only possible according to the initials. And since there can be more than 100 contacts under a single initial, It does not gurante that just scrolling to the initial would make the searched contact come to view. So, is there a way to achieve what I am trying to do with this setup? or do I need to change my setup completely?