I have a recycler view I'm using with a GridLayoutManager. When the user clicks on an item of view, a view is animatated with scale animation to display further details of the adapter item. I have a button to reverse this animation and remove the details off screen.
The problem is when the details view is displayed the user can still click on the recycler view and animate a different view. Can any tell me how to disable the recycler view?
I've tried rc_view.setEnabled(false);
rc_view.setClickable(false);
and I've followed this and none of them has disabled the recycler view.
Can anyone help?
Might sound stupid, but same thing happened to me on my menu (when clicking on open spaces the click events were passed to the recycler).
This was fixed by adding "clickable='true'" on the top view so it doesn't pass the click event to the recyclerview.
Let me know if this helps
Use recyclerView.setClickable(true)
Related
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
I am trying to implement a recycler view which will show items with rating and when ever rating changes it will flip the current rating with animation.
I am doing this on onBindView. The problem I am facing is, onBindView is called even view holder is partially visible ie. rating view is still not on screen and as a consequences it animate before its time.
Any help is appreciated. Thanks in advance.
You can listen for scroll events and determine which items have transitioned between non visible and fully visible.
Register a scroll callback with:
RecyclerView.addOnScrollListener
If you are using a LinearLayoutManager your callback can use the following methods to determine which items are visible:
LinearLayoutManager.findFirstVisibleItemPosition
LinearLayoutManager.findLastCompletelyVisibleItemPosition
It is up to you to track the changes in item state between non-visible and visible.
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
I have 40 ImageViews inside a GridLayout, they have different colors and I want to know if user touched the desirable image or somewhere else(for example if user touched red image). How should I do that?
Set an OnClickListener for each view and store the views. In onClick you can check the view and know what ImageView was clicked. You could also think about changing the type to ImageButtons!
If you have further problems with your Grid not being able to be clicked, check this out: http://cyrilmottier.com/2011/11/23/listview-tips-tricks-4-add-several-clickable-areas/
TLDR: Disable focusing of the views in your layout.
If you manage your images in a collection maybe think about switching to gridview and implement an adapter with an itemClickListener. So depend on which item is clicked do you action.
How GridLayout items come from the Adapter(List/Image) in Android App
I'm using cards to show a list in a recycler view and have implemented Swipe-To-Show-Background feature. But I'm struggling to figure out how to dynamically add a view underneath the card which doesn't get moved but gets displayed when the top view item gets moved?
I can't obviously have the back-view and front-view in the same card, as they both will get swiped.
Edit:
So, I've a card view that has swipe left/right feature. I want to show a view in its background when swiped right. My biggest issue here is I'm not able to dynamically add a view and make it visible when the card is swiped.
I don't have enough reputation to comment so i am posting this as answer.
Firstly, please elaborate your question properly it is a bit vague. Meanwhile, to change background dynamically you can try setBackgroundResource(R.drawable.xxx)