【问题标题】:Android Vitamio Video FullScreen not WorkingAndroid Vitamio 视频全屏不工作
【发布时间】:2013-08-14 10:05:06
【问题描述】:

我已从此处http://www.vitamio.org/en/Download/ 下载了 Vitamio 示例,并且我已成功在我的 Android 屏幕上播放视频。但是如果我改变我的屏幕方向,我将无法获得全屏模式。

有人可以帮忙吗?

布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <io.vov.vitamio.widget.CenterLayout
        android:layout_width="match_parent"
        android:layout_height="300dp"
         android:layout_marginTop="40dp"

        android:orientation="vertical" >

        <io.vov.vitamio.widget.VideoView
            android:id="@+id/surface_view"
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true" />
    </io.vov.vitamio.widget.CenterLayout>


    <FrameLayout
                android:id="@+id/mainlayout"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_marginLeft="1dp"
                android:orientation="vertical" >

                <ImageButton
                    android:id="@+id/playbtn"
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:layout_marginLeft="1dp"

                    android:background="@drawable/play" />

                <ImageButton
                    android:id="@+id/pausebtn"
                    android:layout_width="30dp"
                   android:layout_marginLeft="1dp"

                    android:layout_height="30dp"
                    android:background="@drawable/pause" />
                 <SeekBar
                android:id="@+id/seekBar1"
                android:layout_width="270dp"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@+id/mainlayout"
                android:layout_marginLeft="40dp"
                android:layout_marginRight="1dp" />

            </FrameLayout>





</LinearLayout>

【问题讨论】:

    标签: android android-layout android-intent android-listview vitamio


    【解决方案1】:

    试试这个

    <io.vov.vitamio.widget.VideoView
        android:id="@+id/video"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true" 
    </io.vov.vitamio.widget.CenterLayout>
    

    【讨论】:

    • 这段代码对我没有帮助,尽管我有和 IceCream Sandwitch 一样的代码
    【解决方案2】:

    使用此方法在活动的 onCreate() 方法中拉伸视频视图

    mVideoView.setVideoLayout(VideoView.VIDEO_LAYOUT_STRETCH, 0);
    

    处理onConfigurationChange();

    使用下面的代码

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
    
        if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
    
            mVideoView.setVideoLayout(VideoView.VIDEO_LAYOUT_STRETCH, 0);
            Log.e("On Config Change", "LANDSCAPE");
    
        } else {
            mVideoView.setVideoLayout(VideoView.VIDEO_LAYOUT_STRETCH, 0);
            Log.e("On Config Change", "PORTRAIT");
        }
    
    }
    

    在你的活动清单文件中也添加这个

    android:configChanges="orientation|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-15
      • 1970-01-01
      相关资源
      最近更新 更多