我的VideoView可以使用,但我的MediaController不起作用。我非常确定我做错了或者可能不是......
这是我的代码:
public class Main2Activity extends Activity {
VideoView resultvideo;
MediaController mediacontroller;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String uri = getIntent().getStringExtra("VIDEO_URI");
Uri videoUri = Uri.parse(uri);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main2);
mediacontroller = new MediaController(Main2Activity.this);
mediacontroller.setAnchorView(resultvideo);
mediacontroller.show();
mediacontroller.setAnchorView(resultvideo);
resultvideo = (VideoView)findViewById(R.id.videoView2);
resultvideo.setVideoURI(videoUri);
resultvideo.start();
}
}

答案 0 :(得分:2)
MediaController 以便工作。您应该调用以下内容:
resultVideo.setMediaController(mediacontroller);