question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Handle is moved when touched after sibling view stub is inflated

See original GitHub issue

Setup

I have a vertical linear layout with a RecyclerView and a banner ViewStub above it.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <ViewStub
        android:id="@+id/stub"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout="@layout/list_item"/>

    <com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller
        android:id="@+id/fastScroller"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        app:handleHeight="40dp"
        app:handleWidth="40dp"
        app:handleHasFixedSize="true">

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/recycler"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
            />
    </com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller>
    
</LinearLayout>

Banner view stub is inflated later, after some conditions are met. To simplify this:

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        findViewById<RecyclerView>(R.id.recycler).run {
            adapter = MyListAdapter().also { it.submitList((0..100).toList()) }
        }

        Handler().postDelayed({
            findViewById<ViewStub>(R.id.stub).inflate()
        }, 500)
    }
}

Behavior

Actual After view stub is inflated, handle is moved down when touched (approximately by an inflated view height). List is also scrolled down. Touch position does not correspond to a handle position.

device-2020-09-29-210938

Expected Handle is not moved when touched. Handle is moved under a finger.

Here is the project that reproduces this issue: testfastscroll.zip

Can you suggest any workarounds?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
vokilamcommented, Oct 20, 2020

Initial issue is fixed. Issue mentioned in https://github.com/quiph/RecyclerView-FastScroller/issues/38#issuecomment-701258330 is still reproducible

0reactions
shahsurajkcommented, Oct 23, 2020

@vokilam , can you create a new issue with the details mentioned so it becomes easier to track. i’ll close this one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ViewStub - Android Developers
The ViewStub thus defined can be found using the id "stub." After inflation of the layout resource "mySubTree," the ViewStub is removed from...
Read more >
ViewStub raises error while inflating more than one layouts ...
After the stub is inflated, the stub is removed from the view hierarchy. That's why it has no parent and mentioned IllegalStateException raised....
Read more >
Aircraft engine operation and malfunction - FAA
If the engine fuel shut-off valve malfunctions, it may not be possible to shut the engine down by the normal procedure, since the...
Read more >
Android™ User Interface Design - Pearsoncmg.com
The regular ID is used for finding the ViewStub, but it can also specify an inflatedID for finding the layout after it has...
Read more >
RANGER HANDBOOK
See the enemy first. 4. Tell the truth about what you see and what you do. There is an army depending on us...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found