Put your video view inside a linear layout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.hp.videoplayer.MainActivity">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<VideoView
android:layout_width="300dp"
android:layout_height="180dp"
android:id="@+id/player"
android:layout_marginTop="40dp"
android:layout_centerHorizontal="true"/>
</LinearLayout>
</RelativeLayout>