I'm trying to have a little icon at the top of a LazyColumn that scrolls like any other item in the list. My googling has yielded no luck and I'm wondering if it's even possible yet. Looking for a resource that could help me implement this. To be clear I know stickyHeader exists and that's not what I'm looking for since it will stay at the top of the screen and not scroll with the items.
You can just add another item in the body of the LazyColumn if it's just like any other row and you want it to scroll.
LazyColumn {
item {
Icon()
}
items(myItemList) {
}
}
Related
Is there a way to get the value of the y position while the screen is scrolling?
I have a situation like this:
LazyColumn() {
item {
box()
box()
box()
ScrollableTabRow(){}
}
itemsIndexed {...}
I need to know when the ScrollableTabRow moves past a certain position on y axis (for example lets say 100.dp )
I tried working with .scrollable()
(something like scrollable)
and with scroll gesture filter
(something like gesture
and with dragGestureFilter
but i cannot get it to work, am i doing something wrong, or is it just not possible?
Basically what i need to do is for the scrollable tab row to act as sticky header after it touches top of the screen.
What i wanted to do is, after scrollable row touches the top of the screen, create some sort of mockup for it at the top of the screen, but maybe there is some easier way?
App is written strictly in compose, so i dont have access to any of the libraries that provide such implementation
Use stickyHeader.
LazyColumn {
item { ... }
stickyHeader {
ScrollableTabRow(...) { ... }
}
item { ... }
}
I have a recycleview that I like to go past the last element when I scroll up. The reason I need to do this is that I have a floating button that if I don't go past the last item, the floating button covers the right part of the last item. I have seen this done in apps such as WhatsApp (see screenshot).
My approach has been to add two empty items to the end of my list and then set visibility of views based on if the items are empty or not. I feel this is more a hack and I was wondering if there is a better way around this.
Below is a screen shot from WhatsApp where at the end of the list, the list scrolls further.
Thanks in advance
There is not need to add two blank items to recyclerview. It may introduce bugs as well while adding new items to the recyclerview. You just need to provide paddingBottom to the recyclerview equal to the height of floating action button and set clipToPadding = false to the recyclerview.
I have already read many question on SO and Google regarding Sticky headers in a recyclerview. However, most of them sticks the complete list item on top. I just want to stick part of my list item to top of recyclerview until the complete item is scrolled. I have gone through some libraries such as this one but still not able to figure out how to get it done. Any help is appreciated.
I want to stick the content which is highlighted in the red box until the complete list item (marked in green) is scrolled.
So you want to stick just a part of your list item link this?
Check out this library
https://github.com/oubowu/PinnedSectionItemDecoration
Combine with this RecyclerView Adapter library:
https://github.com/CymChad/BaseRecyclerViewAdapterHelper
I'm trying to implement a FAQ screen in my project and I wanted to use ExpandableListView. I display question as a text in GroupView and answer as a text in ChildView. If items can fit into screen, there's no problem, it works as it should. But when there's more items than the screen height and I have to scroll, this problem occurs that when I expand the last item, it acts like it's expanded but I can not scroll to the child view.
Any ideas or experiences on this issue?
Here's the screenshot (as you can see, scrollbar shows that it's expanded and there's place to scroll, but when I try to scroll, no luck) :
EDIT: I found out that this problem is because I'm using a WebView inside child row, when I switched to TextView it works as expected. How can I achieve the same result with WebView?
In your getGroupView() method of BaseExpandableListAdapter, give view=null as the first line of the method.
I would like to change the default behaviour of my listview, so when im scrolling to the last item, the list will keep scrolling untill the last item is at the top of the list.
default behaviour stops scrolling when the last item is fully in view.
Any ideas on how i can go about this pre 2.3?
Thanks,
Totem.
In case anyone is interested in the solutions available it either:
1) add to the list view padding, that solution forces you to play around with the fading edge property since it gets sifted because of thee padding. also this method might not work well if your using a transparent background because items will be rendered and visible under the padding area. Although this could be fixed by entering the list into a relative layout and making sure to draw something over that area.
2) add transparent items to the listview for offset and not set them as enabled to avoid dividers, just need to make sure to change getItemCount and getItemTypeCount and so on if your if your item isn't really inside your adapter as per my case.
I went with option two.
Thanks,
Totem.