Problems with view's visibilities in RecyclerView (View.GONE)
See original GitHub issueI have a scenario of test where I need the check if a specific view of an item of RecyclerView.Adapter
was setted with visibility = View.GONE
, so this is my assert:
recyclerView(R.id.recycler_view_id) {
atPosition(1) {
notExist { id(R.id.label_id) }
}
}
but when a run this code above the test fail. I made some asserts to verify the visibility of the R.id.label_id
and always return the visibility = View.GONE
.
I tried to use notDisplayed
, but I got the same result.
The curious point is, when my RecyclerView
has only one item and I used notExist { id(R.id.label_id) }
without the recycler view wrapper (recyclerView(<id>) { ... }
) it worked.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Visibility of items not working in recyclerView - Stack Overflow
So let's consider a scenario when we end up with having no image on view. Item at position 0 should show up icon...
Read more >Reveal or hide a view using animation - Android Developers
Initially hide the content view. contentView.visibility = View.GONE // Retrieve and cache the system's default "short" animation time.
Read more >Applying Data Binding for Views | CodePath Android Cliffnotes
If you see an error message such as cannot resolve symbol 'ActivityMainBinding' then this means that the data binding auto-generated class has not...
Read more >MotionLayout: setting visibility programatically at runtime not ...
but with two modifications - my RecyclerView is in SwipeRefreshLayout and one more view to show it only while refresh is going, thus...
Read more >android-recyclerview item visibility=gone
Visibility is determined not just by the View#setVisibility(int) state of views, but also whether views exist in the current view hierarchy. The class...
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 FreeTop 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
Top GitHub Comments
My case is similar:
I don’t think your response is related to the issue, actually i added a customized matcher in RecyclerViewMethods.
I can find that when matchSafely is called inside my CustomerMatcher, it is not passing the matched childview but the recyclerView itself.
Well, after spending a lot of time on this bug and not getting into a solution, I’ve created new methods so we can match the child views in a
RecyclerView
item. Unfortunately, now we can only use the childviewId
and not all the other attributes that we had (text, contentDescription, etc.).Here is the PR with the work around for that issue: https://github.com/concretesolutions/kappuccino/pull/113 This should allow people to match child views in a recycler view item safely, but only using the view Id.
Need help to investigate this and came up with a proper solution 🙏