How can i scale the last and first listview item (depend of finger position)?
For example, ListView, contains 10 elements. Visible only 5. We start scrolling, new element from bottom started scaling from minimal scale, old first visible element started scale down. If we stopped scroll (but not touch up) scale saved.
This is not animation in the usual sense. How can i to make it?
Related
I build a RecyclerView with sizable items, but at moment the width is only scalable trough a EditText input.
Is it possible to add an ScaleGestureDetector on the Frame of the items, so when user touches it a long time (500ms) he can move the frame of the item and size the width?
Could you maybe show me an example about that, I never worked with gestures.
See this Example
I have a RecyclerView where I have enabled dragging to swap item order, however there's an issue with the draw order, sometimes when I am dragging one of the rows it is drawn under the other rows, instead of above them (this seems to happen most often when dragging an item down the list).
Is there a way to make sure that the view that is being dragged is always rendered on top of the other views?
I dont know how to achieve this effect on long click. Long click on image in pinterest android app. Three buttons sliding from red ring to left.
Edit: like this https://github.com/GnosisHub/GHContextMenu
Put 3 invisible ImageViews in the layout (these are the buttons). Set an onLongCLickListener on the larger ImageView. When the long click occurs, make the three buttons visible and animate them into position with ObjectAnimator or ViewPropertyAnimator. When you want to dismiss the buttons, animate them back to where they started and make them invisible again.
You will have to do some math and figure out how far to translate (move) the buttons in the X and Y directions, and it will be different for each button. I suggest placing the buttons where you want them to be when they are visible. When you want to animate them, calculate the difference between their current position and the center of the larger image (or from the touch location). Then you set translation X and translation Y to those values and animate them back to 0.
I will try to explain.
I have a ListView with its adapter which defines the method getView (as usual) for retrieving the appearance of the cells. The final appearance of the ListView is the one shown.
As you can see the first arrow is rotated of 180 degrees. It has been rotated with an animation once I clicked on it. If I'd click on it again it would be rotated to the original position again. The rotation of 180 degrees is maintained with the fillAfter parameter of the animation (then it is not fixed definitively once the animation completed).
The problem is the following: when list view is scrolled and the cell with the rotated arrow is brought out and in again the cell's view is loaded again. At this point I need to rotate the arrow again. I have two ways:
use arrow.setRotation(180f)
use the same animation used before with the duration set to 0
Both the ways have a problem:
The rotation is fixed, then when I call the method for rotating the arrow to its original position the arrow is ALREADY on its original position (because of setRotation)
The rotation is not immediate, then, when the cell is brought out and in again, for an instant it points right and after a moment left
How can I solve this problem?
I need to rotate the arrow before of bringing it in again but without fixing its state as rotated of 180 degrees.
I will suggest you if you have less posibilites of items to be placed in listview then use Dynamic Linearlayouts in ScrollView instead of ListView. As ListView generates many complexities in its own layout In making custom adapter like putting edittext in listview and do some action like delete/animation on UI component of yout listItem.
I need to implement a scrolling layout which is loaded with images from an Adapter, and another scrolling layout on top of it (second layer of a FrameLayout) that contains text labels of individual images. The top layer should scroll with a "parallax effect": http://upload.wikimedia.org/wikipedia/commons/3/34/Parallax_scrolling_example_scene.gif -- but in our case, unlike in that animation, the items in the background and foreground layers are related to each other since the text labels obviously belong to and describe the images. The layers can be listviews with custom dynamics (top one is faster than the bottom one) but I'm not sure how to sync them; couple of ideas:
when movement stops in both layers, redraw one of them to match the visible items of the other list -- but this leads to flicker/jumps
or top layer could dynamically increase spacing between the items based on velocity so the slower background layer could keep up with its movement -- but I'm not sure of the Math required for this
Use the 2 listviews with custom dynamics and then relate their speed by the distance between the images. So, where x is the speed of the foreground listview and y is the speed of the background listview, y=x*(subimage2.y-subimage1.y)*percentile.
I have finally implemented it using a fast scrolling top layer with bigger size albums and two slower bottom layers with small albums (both layers have text and image combined together).