GridView delete multiple items like iphone apps uninstallation View - android

I have a GridView in which I am showing list of books. I have tried by creating custom layout and putting cancel button onlongclick listener of a view. But i am not able to apply a shaking animation to the items. Can anyone guide me how can i apply an animation to the items and make it similarly like iphone?
Now I want to provide feature to delete the Multiple items from the GridView like the View which shows as below:
I did lots of research for this ,but failed to get such kind of view in Android.
Can any one guide me for this?

You'll have to make a custom gridview for that. Place a button (x) on top of the grid item and set its visibility to invisible.. onLongPress of the grid item, make that button visible.. onclick of the button, delete that grid item by getting its id.
Hope I have given you a direction.

Related

Swipe and tap to enlarge recycler view

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

Android: Detect if user touches a view inside parent view

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

Animate Group Expansion in expandable list view

I am using expandable list view for my app. Everything is working correctly, but I want an animation when a group is going to expand i.e all the childs should come with an animation when a group is clicked. Does any one of you have any luck in this regard?

Android listview with buttons

I have a listview with custom listitem. I have bunch of textviews in Relative layout. And when I click on listitem it goes to different screen. Now I have added 3 buttons and toggle button to list item and I CAN NOT CLICK THE LIST ITEM. What am I missing :(
set focusable property of all the buttons to false and so that you can click on list and also touch event for all buttons will work
When the user clicks the row, the ListView will look for a widget implementing the Checkable interface. The RelativeLayout does not. An easy way to do that is simply to create your own CheckableRelativeLayout class. See http://www.marvinlabs.com/2010/10/custom-listview-ability-check-items/ for a full tutorial with code.
Also, the buttons and other items in your row layout should not be focusable. You can see other SO questions: Android Row becomes Unclickable with Button

Is it possible to animate the appearance and disappearance of a delete button in each listview item in Android?

I have a listview in my android application, and i want to have a delete button in each item.
I want to show/hide this button by toggling an external button. Is it possible to do this with an animation? Also the animation has to be synchronized on all items.
I know how to do this without animation but with animation i have no clue.
Does anyone know how to do that?
Thanks
If you take a ScrollView that has a LinearLayout inside it. Then by adding rows to it using an inflater for the custom row and inserting each row into the LinerLayout you mock a ListView. It's actually faster for smaller ListViews to do this. Inside your LineraLyout set the android:animateChanges = "true" then add an onClick listener to the button in each row that will remove the view from your LinerLayout you can get the desired effect. It is all in one of the samples on the Android website. If you need source code I can post an example but to see the effect in action look to a sample app I published on Google Play called My Gratitude List that I published to practice some layout effects. Here is the link to the app.

Categories

Resources