a244376116 2016-11-21 13:02 采纳率: 0%
浏览 3681

android 视屏播放器 全屏显示进度条 并自动隐藏的问题

编写了一个播放器,全屏播放,触摸屏幕,显示下方的进度条和控制按钮(默认情况下自动隐藏)这个已经编写成功了。如图
图片说明
但是我现在也想弄一个标题栏显示播放的视频名字,默认情况下隐藏,触摸屏幕时和下方的进度条等一起显示出来,然后出现问题了,上方的标题栏触摸屏幕显示不出来。
部分代码如下

            //这个是我上方的标题栏
     <LinearLayout
        android:id="@+id/ll_theme"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:orientation="horizontal"
        android:visibility="invisible">

        <TextView
            android:id="@+id/tv_theme"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="文件标题"/>
    </LinearLayout>


    <SurfaceView
        android:id="@+id/sv_player"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

//下方的进度条等
    <LinearLayout
        android:id="@+id/ll_ctrl"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:gravity="center_vertical"
        android:orientation="horizontal"
        android:visibility="invisible">

        <ImageButton
            android:id="@+id/ib_play"
            android:layout_width="45dp"
            android:layout_height="45dp"
            android:onClick="play"
            android:src="@drawable/ic_action_playback_pause"/>

        <ImageButton
            android:id="@+id/ib_forw"
            android:layout_width="45dp"
            android:layout_height="45dp"
            android:onClick="forw"
            android:src="@drawable/ic_action_playback_forw"/>

        <SeekBar
            android:id="@+id/sb"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:max="255"/>
    </LinearLayout>
   public boolean onTouchEvent(MotionEvent event) {
        if(event.getAction()==MotionEvent.ACTION_DOWN)
        {
            ll_ctrl.setVisibility(View.VISIBLE);
            ll_theme.setVisibility(View.VISIBLE);
            new Thread()
            {
                public void run()
                {
                    SystemClock.sleep(3000);
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            ll_ctrl.setVisibility(View.INVISIBLE);
                           ll_theme.setVisibility(View.INVISIBLE);
                        }
                    });
                }
            }.start();
        }
        return super.onTouchEvent(event);
    }

现在怀疑是布局文件出现错误。。请各位大神指点。。。

  • 写回答

2条回答

  • viewgroup 2016-11-22 03:26
    关注

    你完整的布局是什么布局?
    相对布局还是层布局?
    这两个布局会让你的surface遮住你的标题栏的

    评论

报告相同问题?

悬赏问题

  • ¥15 易盾点选的cb参数怎么解啊
  • ¥15 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 UE5#if WITH_EDITOR导致打包的功能不可用
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?
  • ¥15 电磁场的matlab仿真
  • ¥15 mars2d在vue3中的引入问题
  • ¥50 h5唤醒支付宝并跳转至向小荷包转账界面