Sketwere video background
1. Add linear layout Add Project
final VideoView vd = new VideoView(MainActivity.this);
vd.setLayoutParams(new LinearLayout.LayoutParams(android.widget.LinearLayout.LayoutParams.MATCH_PARENT, android.widget.LinearLayout.LayoutParams.MATCH_PARENT));
vd.setVideoURI(Uri.parse("android.resource://"+getPackageName()+"/"+R.raw.vimavideo));
vd.requestFocus();
vd.start();
vd.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
vd.start();
}
});
//this layout will conatin your video view
RelativeLayout rl = new RelativeLayout(this);
//this layout will contain your widgets which are to be shown on video
RelativeLayout rl2 = new RelativeLayout(this);
rl2.addView(vd, -1,-1);
linear1.removeAllViews();
rl.addView(rl2, -1,-1);
rl.addView(linear2, -1,-1);
linear1.addView(rl,-1,-1);
//this property will all the video to be played in full screen
DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); android.widget.RelativeLayout.LayoutParams params = (android.widget.RelativeLayout.LayoutParams) vd.getLayoutParams();
params.addRule(android.widget.RelativeLayout.ALIGN_PARENT_TOP, android.widget.RelativeLayout.TRUE);
params.addRule(android.widget.RelativeLayout.ALIGN_PARENT_START, android.widget.RelativeLayout.TRUE);
params.addRule(android.widget.RelativeLayout.ALIGN_PARENT_END, android.widget.RelativeLayout.TRUE);
params.addRule(android.widget.RelativeLayout.ALIGN_PARENT_BOTTOM, android.widget.
RelativeLayout.TRUE);
vd.requestLayout();


