Current animation changes alpha for every part of view. I want to change the alpha through view's x and y positions. Think it as a growing horizontal bar. I have a view which is drawn by myself (canvas). Also the issue is this drawn views are in list view, they are the listview elements. So probably i need to animate ListView itself not the elements to achieve desired outcome
How can i achieve it?
Related
I've been trying to implement an activity where I can scroll horizontally and vertically in all directions, I've tried out using gesturelistener and the "scrollby" method in View, however the screen is still static. I've also done a nested horizontal and vertical scroll in xml, however this only gives me scrolling to the right of the screen and bottom. It seems i cant move in the negative x direction.
Thanks.
Customize ViewGroup
Override OnTouchEvent
Detect MotionEvents
Track Finger Points
Calculate Distance Moved
Modify the X and Y of the canvas Content Rectangle.
Finally in your layout add child views you want to scroll inside this ViewGroup
Source code: https://gist.github.com/jayakrishnan-pm/ScrollingLayout.java
I have a view that I want to animate- scale it to a bigger size and at the same time move to the very top of the screen, just below the notification bar. The problem is however, at least I think, that the translationY complies with initial view scale and moves it to the top of the screen, but as the view grows, it gets cut off at top.
This is the code I'm using
image.animate()
.alpha(1f)
.translationY(0)
.scaleX(6f)
.scaleY(6f)
.start()
Any simple solution to this? A way I could calculate the real value I should set translationY to (based on scale) in order to be positioned correctly? Any help appreciated!
I'm doing a simple programmatic, Y-axis translation on two neighboring views using ObjectAnimator.
The area vacated by the first view seems to "hide" the content of the second translated view that moves into those bounds.
I've tried invalidate() to no avail. What else should I be doing?
There are some circle(Custom View) in a vertical layout and I animate height of circles by tapping them .(by property animation)
but enlargement of these views do not affect position of circles before and after them.
how can I do that?
A scale animation changes the way a view it's drawn, but it doesn't affect the parent's layout. What you need in this case is to update its LayoutParams (via an animation) so that the position of any other controls are adjusted accordingly.
See this answer for an excellent sample.
I have a RelativeLayout with a view inside. The view overtimes changes it's position so my question is I'm running into an issue where say the top and left coordinates are say max height and max width and the view is displayed partially on screen while the rest is cut off .
So my question is when translating the view is the view adjusting relative to the center pixel of the view or the bottom left top left bottom right or top right?
In the case of translateX and translateY it doesn't matter. No matter what anchor point you would use, the result would be the same. Scale and rotation however rely on the anchor point (or pivot) defined by setPivotX/PivotY.