pravin pravin - 2 days ago 4
Android Question

how to show this video on splash full screen and in portrait mode

https://www.freeloops.tv/time-lapse-videos-1/mountains-snow-time-lapse-1/

myvideo =(VideoView )findViewById(R.id.myvideo);
myvideo.setVideoPath("android.resource://" + getPackageName() + "/" + R.raw.loopxx);

DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics);
android.widget.LinearLayout.LayoutParams params = (android.widget.LinearLayout.LayoutParams) myvideo.getLayoutParams();
params.width = metrics.widthPixels;
params.height = metrics.heightPixels;
params.leftMargin = 0;
myvideo.setLayoutParams(params);
myvideo.start();
myvideo.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.setLooping(true);
}
});

Answer

You need to use RelativeLayout and set layoutAlignParentBottom as well as top,left and right true to show video in full screen.

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