I'm trying to do menu footer which have 10 button and can horizontalscroll.
So i use recyclerview to do that.
What i want is this footer by default always show only first 5 items in screen with all screen size and user can scroll this.
So i have a question
How to show fixed number of items of rows in a recyclerview ?
How to set distance of 2 items in a list recyclerview ?
Thanks for read.
Related
I have horizontal RecyclerView with 10 items with square fixed size and with attached LinearSnapHelper.
I want to see an integer number of items in the list depending on the width of the RecyclerView.
Example:
I think that I have to somehow calculate the width of the RecyclerView and find how many whole items will fit into the visible part of the list, and the remaining space should be reserved for spacings between items. After that, user scrolls items with SnapHelper. Thanks in advance for help!
EDIT:
I do not want to show all the items from the list at a time, but only those that fit into the visible area of recyclerview and calculate spacings dynamically between items
I have a listview items in cardlayout format. These first item of listview is partially visible from bottom of the screen . And rest all items becomes visible as user scrolls it up.
I want to make make listview items partially overlapping each other, in order to bring a stack effect while cards are in down state.
I have an Horizontal listview i want listview should be closed. For example if the last item is reached in Listview then show the first item below the last item. It means item should be in circular format. And if i scroll from first item it should show last item before first item. I want scrolling for both side.
Below image can tell u what exactly i want
In the First image it is showing 5 items and when scroll the Listview it should scroll the items As shown in Second image Thanks In Advance.
As per your requirement you want circular/infinite scrolling horizontal list view,
This is InfiniteScrollView which may help.You need to update this library as per your requirement and change ImageView to any other view which you want to scroll horizontally.
Edit - Solution below works for scrolling list view circularly only on one side ::
Check this circular-list for implementing a circular list adapter. And as your list view is horizontal check this library to create a custom horizontal list view.
Happy Coding :)
I would like to have last item of the listView aligned on the bottom.
In case there are 1 to several items on the list, there should be an empty space between last item and second to last item.
In case there are many items (they do not fit in the list, scroll is shown), the list should behave normally.
I tried to make it so that when list consists of some small hardcoded number (6) of items (or less), last item is separate view aligned to the bottom of the parent of the listView. When there are more items, I set visibility of this view to GONE and added same view to the listView. It was working fine, but not for all devices. Some fit 6 items, but others fit 7.
Is there any way to align last item to the bottom of the listView (so the listView has always the same height as its parent)?
Maybe the easiest way to implement this will be just to add your last element as footer using addFooterView
I have a list of about 100 items. In each list item I need a framelayout with 2 relative layouts. When a button called "Flip" is clicked then one relative layout will flip out and the other relative layout will flip in. And each item has full width of the screen. So, I need to show the item in a horizontal scroll view. Now, I want to keep at most 3 items every moment. When user scrolls to the first item then we have to update the 3 items. The first item will be the 2nd item. And we have to add another item at the front. In this way we have to update the items when user scrolls to the last item. I have tried many ways. I have used Gallery for the horizontal scroll view. And used the onItemSelected method. But, if I scroll the Gallery fast then it crashes. So, please someone help me to implement the 3 items idea.
It sounds like you need a ListView. Is there a reason you are trying to reinvent it?
Also don't you mean a vertical scroll view? Why are using a horizontal?