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
Related
I want to use a TextSwitcher (or some other switcher with TextViews inside) to animate changing Text.
It should have a sliding animation to slide the old text out to the left and the new one in from the right.
My problem is that when a long text gets replaced by a short text, the TextSwitcher changes its height to a smaller view and the view that is moving out of the screen changes its height too. I want the animated view that is moving out of the screen to keep its height until its gone. Only the new Text should have the new height.
I have
android:measureAllChildren="false"
enabled because my TextView is centered vertically.
I have tried using TextSwitcher, ViewSwitcher and ViewFlipper, but all of these changed the height of the text that was sliding out.
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'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"
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!
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?