I can't view my textviews can someone help
https://i.stack.imgur.com/XucDi.png
Related
I am using recycler view inside BottomSheetDialogFragment with dialog state behaviour as BottomSheetBehavior.STATE_EXPANDED but when I notify recycler view with notifyDataSetChanged the bottomSheet scrolls down.
The expected behaviour is that the bottomSheet height remains same.
Please help me in achieving this??
I need to implement left and right buttons in recycler view. I need to have 3 buttons in left side and right side. Also when say bottons like Pin, Edit etc. Something like below images.
I have implemented this using item decoration of recyclerview
val itemTouchHelper = ItemTouchHelper(swipeController)
itemTouchHelper.attachToRecyclerView(recyclerView)
recyclerView?.addItemDecoration(object : RecyclerView.ItemDecoration() {
override fun onDraw(c: Canvas, parent: RecyclerView, state: RecyclerView.State) {
swipeController.onDraw(c)
}
})
When I select favorite in a row that state needs to be saved and when I swipe that particular cell again it should be highlighted to show that it is selected. I am not able to implement this. Please let me know if there is some alternative solution to implement this.
Thanks
I have a CordinatorLayout in which there is CollapsingToolbarLayout and below it is NestedScrollView to achieve collapsing with:
app:layout_behavior="#string/appbar_scrolling_view_behavior"
Inside nested scroll view there is a RecyclerView. I need to auto scroll the RecyclerView to a particular position when the Fragment is called. Need to set it programmatically. Any help please.
try this:
Handler(Looper.getMainLooper()).postDelayed(
{
binding.nestedScrollContainer.smoothScrollTo(0, binding.myRecyclerview.bottom)
binding.myRecyclerview.nestedScrollBy(0, binding.myRecyclerview.bottom)
},
200
)
i made a recycleview that works just fine and gets the data and show it but i want that instead of vertical scroll it will be horizontal scroll.
i searched and read that to control the scroll orientation behavior i need to use the LinearLayoutManager and set it like this:
LinearLayoutManager mLayoutManager = new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,false);
recyleview.setLayoutManager(mLayoutManager);
but it dosent work and i dont know why all the examples i saw are with this at the core
anyone have any idea why?\
thanks for any help :)
it was about this line:
LinearLayoutManager mLayoutManager = new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,false);
but since i tried a couple of tutorials i had this line somewhere else in my code that i forgot to delete it. the problem it was set with .VERTICAL so when it run the code with .HORIZONTAL was running just fine but because later in the adapter initialize i had the same line but with .VERTICAL so it just overwrite the .HORIZONTAL
so in conclusion just make sure you have ONE LinearLayoutManager initialize at a time :D
I want to scroll the RecyclerView to a position, and I use LinearLayoutManager.scrollToPositionWithOffset() to scroll.
But it does not work. Could any one help me?
RecyclerView rv = findViewById(R.id.recycler_view);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
rv.setLayoutLayoutManager(layoutManager);
layoutManager.smoothScrollToPosition(position);
Scrolling RecyclerView to certain item position can be achieved with LayoutManager which is used with that particular RecyclerView. Plz refer to above piece of code
If you don't have a lot of items in your list, you can use LinearSmoothScroller
val smoothScroller = object : LinearSmoothScroller(activity) {
override fun getVerticalSnapPreference(): Int {
return SNAP_TO_START
}
}
and then when you want to scroll:
smoothScroller.targetPosition = position // position on which item you want to scroll recycler view
binding.cardsRecycler.layoutManager?.startSmoothScroll(smoothScroller)