Background video in Sketchware
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(your video path));
vd.requestFocus();
vd.start();
RelativeLayout rl = new RelativeLayout(this);
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();

Comments
Post a Comment