dnAir
dnAir

Reputation: 287

RecyclerView inside a constraintLayout inside a drawerLayout will not scroll

Don't know what else to add. It just won't scroll, I tried around quite a bit. here is the setup:

MainActivity:

...slimeDrawer.setOnClickListener { mainDrawer.openDrawer(ipsDrawer) }...

the referenced "ipsDrawer" in activity_main:

<include
    android:id="@+id/ipsDrawer"
    layout="@layout/drawer_ips"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="left"/>

inside the drawer_ips.xml the recyclerView that wont scroll:

<androidx.recyclerview.widget.RecyclerView
    android:id="@+id/ipsRecycler"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:orientation="vertical"
    android:clickable="true"
    android:focusable="true"
    android:scrollbars="vertical"
    app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="1.0"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/imageView17"
    app:layout_constraintVertical_bias="0.0" />

the class that handles the stuff for the recycler:

class Ips : Fragment() {
    companion object : LifecycleOwner {
    fun startIps(activity: Activity, ipsDrawer: View): Ips {
        val userDatabaseDao = UserDatabase.getInstance(activity.application).userDatabaseDao
        val ipsJob = Job()
        val ioScope = CoroutineScope(Dispatchers.IO + ipsJob)
        val stats = userDatabaseDao.getAllStats()
        val ipsAdapter = IpsAdapter()

        val ipsRecycler = ipsDrawer.findViewById<RecyclerView>(R.id.ipsRecycler)
        ipsRecycler.adapter = ipsAdapter
        (ipsRecycler.adapter as IpsAdapter).submitList(stats.value)

        stats.observe((activity as AppCompatActivity) as LifecycleOwner, Observer {
            ipsAdapter.submitList(it)
        } )

here is the complete activity_main and drawer_ips and a video of it not scrolling:

https://pastebin.com/QYp3i5jz

https://pastebin.com/b3mCC4Cd

https://streamable.com/4v4tlc

if you need any more information let me know

Upvotes: 0

Views: 76

Answers (1)

dnAir
dnAir

Reputation: 287

in activity_main i moved the to the last position of the drawerLayout and now it works

Upvotes: 1

Related Questions