perennial_
perennial_

Reputation: 1846

Animating views beyond parent container android

I am trying to create a view that will receive a translation animation and animate to the position of another view on the screen, however it disappears as it leaves its parent layout (a frame layout). I am looking for something similar to View Overlay, however I want to be able to use it before API 18, which is not possible for View Overlay. The View is inside a Frame Layout, which is inside a table row, which is inside a table layout. Is this possible without upping the minimum required API?

UPDATE If I create a FrameLayout and add a new View to the new layout like so:

    View newView = new View(this);
    newView.setBackgroundColor(Color.BLACK);
    newView.setLayoutParams(new TableLayout.LayoutParams(initialColourView.getWidth(),      initialColourView.getHeight()));
    FrameLayout frame = (FrameLayout)findViewById(R.id.full_view_layout);
    frame.addView(newView);

I can animate the view; however the newView's width is the full screen, not the width of the initialView like I want it to be.

Upvotes: 1

Views: 812

Answers (1)

perennial_
perennial_

Reputation: 1846

I solved my own problem; all that you need to do is set

android:clipChilderen="false" 

in all layouts that the view to be animated is a child of. (In my case, that was the frame layout, the table row, and the table layout)

Upvotes: 3

Related Questions