📜  android videoview setup - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:46.378000             🧑  作者: Mango

代码示例1
protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.your layout xml file);
        VideoView videoView = findViewById(R.id.your videoview id);
        String videoPath = "android.resource://" + getPackageName() + "/" + R.raw.your video's name;
        Uri uri = Uri.parse(videoPath);
        videoView.setVideoURI(uri);
        videoView.start();