ViewFlipper中的VideoView无法拉伸到全屏

时间:2016-08-02 11:17:37

标签: android android-videoview viewflipper android-viewflipper

我想在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);

0 个答案:

没有答案