[Bug] Handle is moved when touched after sibling view stub is inflated
See original GitHub issueSetup
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.
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:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Initial issue is fixed. Issue mentioned in https://github.com/quiph/RecyclerView-FastScroller/issues/38#issuecomment-701258330 is still reproducible
@vokilam , can you create a new issue with the details mentioned so it becomes easier to track. i’ll close this one.