【问题标题】:Video View Media Controller Android视频查看媒体控制器 Android
【发布时间】:2014-09-08 09:46:24
【问题描述】:

我在我的代码中使用 VideoView 从 URL 播放一些视频。我的 VideoView 位于 ScrollView 内的线性布局内。
我的 MediaController 对象出现问题,它出现在视频视图底部,而不是位于 scrollView 内的其他视图和屏幕中的恒定位置(我的意思是当向下滚动屏幕时,所有视图都会移动,除了这个)
我想将此 MediaController 设置在 videoView 下面的常量位置,该位置随滚动条移动。
我的 XML 代码在这里:

    <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="94dp"
        android:layout_marginTop="196dp" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

            <AbsoluteLayout
                android:id="@+id/nonVideoLayout"
                android:layout_width="match_parent"
                android:layout_height="match_parent" >



                <LinearLayout
                    android:id="@+id/playerLayout"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" 
                    android:orientation="vertical">

                    <com.HRDatis.component.VideoViewQmery
                        android:id="@+id/playerImage"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content" />
                </LinearLayout>

这里还有JAVA代码:

    ((LinearLayout)(findViewById(R.id.playerLayout))).setLayoutParams(new LayoutParams((int)(width) , (int)(height*0.371) ,0 , (int)(height*(0.0)) ));
    VideoViewQmery videoView =((VideoViewQmery)(findViewById(R.id.playerImage)));
    MediaController mediaController = new MediaController(this); 
    mediaController.setAnchorView(videoView);
    videoView.setVideoURI(Uri.parse(URI));
    videoView.setMediaController(mediaController);

请注意,在 onCreate 函数的活动中在 java 中设置的所有维度。此外,我对 mediaController 使用了 setLayoutparam 函数,但它不起作用,并且 mediaController 没有移动。只有 SetY 和 SetX 有效。此功能移动与 VideoView 相关的 MediaController 并没有解决我的问题(我的意思是 MediaController 没有随 Scroll 移动)。 提前致谢。

【问题讨论】:

    标签: java android android-layout scrollview android-videoview


    【解决方案1】:

    这可能是你的解决方案MediaController Positioning - bind to VideoView

    正如解决方案中提到的,控制器不会通过点击视频视图来显示和隐藏,但你提到无论如何都希望它是静态的

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-01-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多