안녕하세요 질문이 있어 글 남깁니다.
현재 프래그먼트 내에 viewPager를 두어서
A_fragment와 B_fragment를 옆으로 밀어서 보여줄 수 있도록 구현하였고,
A_fragment 내에는 swipeRefreshLayout 내에 recyclerView를 위치시키고,
adapter 내에서 bind를 통해 item을 클릭했을 시, 디테일뷰로 넘어가도록 구현하였습니다.
swipeRefreshLayout in A_fragment:
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/srl_BookmarkPostList"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_PostList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:orientation="vertical"
android:paddingBottom="80dp"
tools:listitem="@layout/layout_bookmark_post_item" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
viewHolder in adapter:
class ViewHolder(binding: LayoutBookmarkPostItemBinding) :
RecyclerView.ViewHolder(binding.root) {
fun bind(context: Context, item: BookmarkPostContent) {
itemView.setOnClickListener {
val manager: FragmentManager = (context as AppCompatActivity).supportFragmentManager
val ft: FragmentTransaction = manager.beginTransaction()
ft.add(R.id.fg_MainContainer, DetailPostFragment.newInstance(item.id), "fm_Post")
ft.commitAllowingStateLoss()
}
}
}
이렇게 구현을 하니, 스크롤이 살짝 내려갔을 때 부터는 item클릭이 되서 정상적으로 디테일 뷰로 넘어가는 것을 확인할 수 있었는데,
스크롤이 최상단에 위치해있을 때는 item이 클릭이 안되네요
swipeRefreshLayout때문인가 싶어 이를 없애고 구현한 후 실행해보니 item클릭이 스크롤 최상단에서도 잘 되는 것을 확인할 수 있었습니다.
이를 해결할 수 있는 방법이 없을까요??