I'm applying a scale animation to a view (a grid item), which is in a gridview, which is in a pager, which is in a linear layout.
Everything already works besides my scaled griditem becomes larger than the gridview / pager, and it's clipped (or hidden? by siblings of the pager). I tried putting android:clipChildren="false"
android:clipToPadding="false" everywhere where there's a parent view and it's supported (in the linear layout and in the grid view), but had no effect.
I also tried calling bringToFront() on the pager, but this also doesn't work, still get clipped and besides of that causes repositions the pager at the bottom of the layout, which is unwanted.
How do I play the animation in front of everything?
Help is greatly appreciated, thanks!
Related
The pattern of the layout is below:
---LinearLayout vertical
---LinearLayout -> contains a LinearLayout that shapes like rectangle(setVisibility-> Gone)
---RecyclerView -> below the above layout of rectangle
Originally, I set a slide-down animation of RecyclerView from the top of the window to a position where it gives enough space for the rectangle to show and when the animation ends the LinearLayout of rectangle is shown by invoking the method setVisibility(Visible)
Problem: when I set the rectangle visible, it is visible as expected but recycler view is dropped down the space as much as the rectangle's height, leaving blank space between the rectangle and the RecyclerView. I wonder what might cause this and how to fix this? Thanks!
I think you may not change the position of the RecyclerView and only set the visibility of the LinearLayout to visible. Changing the visibility will redraw the whole layout and the layout that was Gone will take its needed height, so the space between the top of the recycler view and the bottom of the layout will be (animation height + layout height) and that is why there is an empty space
I am using a ConstraintLayout with two views inside. An ImageView that varies in size depending on the image loaded and a View which acts as a custom made dropshadow for the Image. What I've been doing so far is adding 8dp padding to the ImageView and then aligning all of the edges of the View to the ImageViews, thereby making the View stick out 8dp underneath the ImageView.
Now for several reasons I don't want to keep the padding on the ImageView but I still want to achieve the same effect. So basically I would like to align the Left of the View to 8dp left of the Left of the ImageView (and the same for every other edge, right, top, bottom).
Is there any way to achieve this?
Thanks in advance!
I´ve been having problems with this too, it seems ConstraintLayout does not support negative margins yet: https://code.google.com/p/android/issues/detail?id=235306.
In my case, I want a 20dp negative margin to a set of overlapping images on a header image. So far, I'm positioning an empty TextView below the guideline my header image is connected to, with a 20dp top margin and aligning my overlapping image views to that.
I'm trying to do a TweenAnimation (Scale and translate) with two ImageViews (top and bottom). Each ImageView (and some other stuff) is in a RelativeLayout and the RelativeLayouts are in a LinearLayout. The images moves to the left top corner of the display. The Animation works fine, but at the end of the (Relative) Layout the animation disappears (in the mid of the display).
Is there any way to give the animation more (all) space then only the parent View? Thanks!
You can set the parent view to not clip it's children and allow them to draw outside it's bounds. In your XML, add this:
android:clipChildren="false"
Right now I have a view that I'm just popping onto the screen by changing the view from GONE to VISIBLE, and I instead want to have a TranslateAnimation that shifts the view onto the screen. As soon as the animation starts the view on the right becomes clipped though. I assume this is because the parent view is taking the width of the view on the left and factoring that into the view calculation? Is there any way to not have that happen, so it looks like both views are shifting onto and off of the screen? Setting
android:clipChildren="false" android:clipToPadding="false"
didn't seem to help
Try to set android:clipChildren="false" android:clipToPadding="false"
on the parent container
I have a RelativeLayout filling the screen and a couple of ImageView positioned on it using LayoutParams margins. These ImageView are animated in different ways, and in one case I want an image to "fly in" to the screen from the right.
Unfortunately, if I set leftMargin for that ImageView greater than the width of the screen, it does not appear (or appears cropped if it partially visible at the start of animation).
I tried setting width and height of RelativeLayout to be bigger than screen size - it works, but only partially: if the image is positioned completely off-screen, it does not work, and if the image is partially visible, it is not cropped, but that works only for right and bottom sides.
So, my question is this: how to position several ImageViews on and off the screen so that I can animate them using Animation?
In the end, I used a trick: I combined AnimationDrawable and view animation. I did the following (assuming that the animation has to run T milliseconds):
Position that ImageView on-screen.
Set as its background an AnimationDrawable with following frames:
empty Drawable: 1ms,
normal Drawable: Tms.
Change view's animation to this:
jump to off-screen position (translation with duration=1ms),
do normal animation.
This is probably a good place to start looking for those who would use Fixpoint's solution.
Android — How to position View off-screen?