我想在VideoView
中设置全屏,这是ViewFlipper
的子项并以编程方式添加,但它不会设置为屏幕大小,而是始终设置为其分辨率。我虽然使用了相对布局。
这是一些代码段
viewFlipper.xml
<ViewFlipper
android:id="@+id/viewflipperSlideShow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoStart="true"
android:flipInterval="2000"/>
这是代码
VideoView postVideoView;
postVideoView = new VideoView(PostSlideShowActivity.this);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
postVideoView.setLayoutParams(layoutParams);
Uri uri = Uri.parse(imageURL);
postVideoView.setVideoURI(uri);
postVideoView.setTag(TAG_VIDEO);
viewFlipper.addView(postVideoView);