Is there a way I can have the MediaController
show always?
videoView = (VideoView) findViewById(R.id.videoView);
String path = "/sdcard/feiyang/video/sfqx.3GP";
MediaController m = new MediaController(this);
videoView.setMediaController(m);
开发者_如何学CvideoView.setVideoPath(path);
videoView.start();
I'm using m.show(0);
, but it doesn't work.
replace the line in your code that creates the MediaController with this:
MediaController controller = new MediaController(this){
@Override
public void hide() {
this.show(0);
}
@Override
public void setMediaPlayer(MediaPlayerControl player) {
super.setMediaPlayer(player);
this.show();
}
};
then call
videoView.setMediaController(controller);
in the same way you already are, that should do the trick.
handle Back key event:
mController = new MediaController(this) {
...
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
((Activity) mContext).finish();
}
return true;
}
};
精彩评论