Hey I am working in android. I have list in horizontal form. I want to do, If my view is half visible in device and if clicked, then me recylerview scroll that item, i.e. it will visible it fully. So How Can I do in my recyclerview. Can someone Suggest me how can I achieved this through recyclerview in android.
The image in which view is not selected and you can see last item is half visible.
The image when view is clicked but item is half visible in device.
I want to fully visible that item, if I clicked on the view like below image. I can't show animation becuase I didn't achieve yet. Hope you guys understand what I want. Thanks
Related
I have a recycler view which has its items in a card view. The recycler view gets its data from a sql database within the app . Now I want to implement two features to this recycler view items. First , whenever the individual cards are tapped , I want them to enlarge and display more data and should shrink back when tapped again. It is not like the case of expandable list view where it expands into a child list view. I want the height of the card to increase and just show some more information and buttons. Second I want the items to swipe left . I know there is a feature for that in recycler view , but I want to customise the swipe feature. Swipe from right should be locked , and when swiped from left , It should not go off list completely. It should show two buttons and should go off list only when one of the buttons is clicked. I have been looking , but there is no proper explaination anywhere. Please guide me through this process.
For your first question, set the adapter layout_height to wrap_content and set the buttons visibility to GONE. Implement the OnClick listener in the RecyclerView adapter and set the visibility of the buttons to VISIBLE if GONE and GONE if VISIBLE or use a boolean to alternate the visibility.
For your second question, this might help:
https://www.learn2crack.com/2016/02/custom-swipe-recyclerview.html
How can I make my Android SwipeableCardViews more like the IOS 7 mail app (swipe to show buttons)
https://github.com/daimajia/AndroidSwipeLayout
What I'm trying to do:
When a list Item is clicked, I want the list to scroll until that Item is sitting on the bottom of the screen.
What I'm currently trying:
myList.smoothScrollToPosition((adapter.getView(position, view, parent)).getBottom());
What's happening there is that the list is scrolling all the way to the bottom, rather than to the bottom of that view.
how can I accomplish this?
if you need more code samples, just let me know :)
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 :)
![enter code here][1]
!http://i.stack.imgur.com/aYZVG.jpg
From the above diagram it will be quite clear what I want. No matter how much scroll the user makes, after the scrolling stop,
the item which is fully seen or the item which has maximum visible area should be centered. Is this possible ? Also the first
item should be centered when scroll to initial area and last item too will be centered when scrolled to last position.
As I have many items I would prefer a listview. Can you guys please help us?
Thanks
Timir
Use view pager and implement it
or you can also use http://android-er.blogspot.in/2012/07/implement-gallery-like.html
View flipper is another approach
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?