MediaController不会自动隐藏在android中

时间:2014-11-05 06:36:32

标签: android mediacontroller

我正在Android中实现Video View,我也在使用MediaController。当视频播放时,几秒钟后媒体控制器不会被隐藏。这是我的代码,

    layoutVideoFrame = (FrameLayout) findViewById(R.id.videoFrame);
    videoPlayerView = (VideoView) findViewById(R.id.videoPlayerView);
    mediaController = new MediaController(this);


    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    lp.gravity = Gravity.BOTTOM;
    mediaController.setLayoutParams(lp);
    ((ViewGroup) mediaController.getParent()).removeView(mediaController);
    layoutVideoFrame.addView(mediaController);

    getWindowManager().getDefaultDisplay().getMetrics(dm);
    int width = dm.widthPixels;
    LayoutParams params = (LayoutParams) videoPlayerView.getLayoutParams();
    height = params.height;
    params.width = width;
    videoPlayerView.setLayoutParams(params);
    videoPlayerView.setMediaController(mediaController);

如何在几秒钟后隐藏媒体控制器,并在用户触摸屏幕时返回?

0 个答案:

没有答案