Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7169433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:59:20+00:00 2026-05-28T14:59:20+00:00

I have an activity whose layout only contains a VideoView. Here is the xml:

  • 0

I have an activity whose layout only contains a VideoView. Here is the xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="match_parent"
 android:layout_height="match_parent">


  <VideoView
android:id="@+id/videoplayer"
android:layout_width="match_parent"
android:layout_height="match_parent" 
android:layout_alignParentRight="true"
android:layout_alignParentLeft="true" 
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
>
</VideoView>

I am trying to apply this animation to the VideoView after it stops playing:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromYDelta="0%" android:toYDelta="-100%" android:duration="500"/>
    <scale
    android:fromXScale="1.0"
    android:toXScale="0"
    android:fromYScale="1.0"
    android:toYScale="0"
    android:duration="500"
    android:pivotX="50%"
    android:pivotY="0%"
     />

</set>

This works perfectly as it is shown. But if I switch from LinearLayout to RelativeLayout in the layout then the animation no longer works and the video just freezes on the last frame that is shown before it stops.

Why would the type of root layout in my activity cause an animation not to function properly?

EDIT: To add to the weirdness if I add this TextView

<TextView
android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text=" ">
</TextView> 

To the RelativeLayout below the VideoView then the animation will work. However if I take the space out of the android:text element of this then it is back to not working. o.O

EDIT: I’ve awarded the bounty to Beowulf Bjornson for the nice tip of using the newer animation framework.

But I am still very interested if anyone ever figures out what is going on with the old style animations in this situation I’d be more than happy to throw some more points up for it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:59:21+00:00Added an answer on May 28, 2026 at 2:59 pm

    I’m not sure if using a third-party library is a viable solution for you, but I strongly recommend NineOldAndroids, so you can use the Animation capabilities of 3.0+ in earlier versions of Android. They make this job WAY easier.

    Here’s the link: http://nineoldandroids.com/

    Then, on you activity you can do something as easy as:

    VideoView view = (VideoView) findViewById(R.id.videoplayer);
    animate(view).scaleX(0).scaleY(0).setDuration(500L);
    

    I’ve tested it using RelativeLayout and it works as expected.

    EDIT: If you wish to use the native honeycomb implementation, this specific API is 3.1+ and it should be used nativelly like the following:

    view.animate().scaleX(0).scaleY(0).setDuration(500L);
    

    And if you wish to nativelly support 3.0, you’ll have to use it like this:

    AnimatorSet set = new AnimatorSet();
    set.playTogether(
        ObjectAnimator.ofFloat(view, "scaleX", 1.0f, 0.0f),
        ObjectAnimator.ofFloat(view, "scaleY", 1.0f, 0.0f),
    );
    set.setDuration(500).start();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Activity whose layout is in the file main.xml that contains a
In my application i have an activity which has the following layout <?xml version=1.0
I am making a custom titlebar using the following xml file: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/myTitle
Hullo, I have an activity whose layout is made of a single FrameLayout. I
I have an activity whose only purpose is to launch an AlertDialog. My issue
I have a Gallery whose Adapter creates several LinearLayout instances. Those linear layout instances
I have Activity A with android:launchMode=singleTop in the manifest. If I go to Activity
I have an Activity in Android, with two elements: EditText ListView When my Activity
I have an activity that contains several user editable items (an EditText field, RatingBar,
Going round in circles here i think. I have an activity called Locate; public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.