VideoView scaling to fill the width while maintaining aspect ratio

In my activity, I need to show an instance VideoView(fullscreen), with a button scaling content similar to iOS media player one. I mean, for example, by scaling 4: 3 content to fill the width of the screen while maintaining aspect ratio (thus effectively trimming the top / bottom of the content).

I just did a quick hack / experiment - VideoViewinside AbsoluteLayout, oversized, so the top / bottom is broken off. It works, but it actually looks like a hack.

I may be blind, but is there an API, for example. choose a sub-rectangle to display in the view?

+5
source share
1 answer

, , :

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center_horizontal">

    <VideoView
        android:id="@+id/myvideoid"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
    </VideoView>
</LinearLayout>

. , http://blog.kasenlam.com/2012/02/android-how-to-stretch-video-to-fill.html

-4

All Articles