i can't remove the white space of my video preview i already added all the alignparent but still dont work. it's source is from a server. the video has no white space in it.
here is my layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.extras.PermitVideoFrag">
<VideoView
android:id="@+id/vid_permit"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerHorizontal="true"
/>
</RelativeLayout>
its really frustrating me now. i can't find a decent answer.
I found an answer. I used DisplayMetrics to measure the fragment's dimension then set it as the dimension of the videopreview:
vid_permit = (VideoView)permit.findViewById(R.id.vid_permit);
vid_permit.setVideoURI(vidUri);
DisplayMetrics metrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
vid_permit.setLayoutParams(new RelativeLayout.LayoutParams(metrics.widthPixels, metrics.heightPixels));
vid_permit.start();