Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/195.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在android应用程序上播放简介_Android - Fatal编程技术网

如何在android应用程序上播放简介

如何在android应用程序上播放简介,android,Android,只是一个小视频,像一个动画,作为一个标志,只有5-7秒,比应用程序应该出现,只是一个简单的我认为视频播放器没有按钮没有点击 你能告诉我该怎么做吗?将你的简介视频文件放在res/raw文件夹中,并将splash布局设置为: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_w

只是一个小视频,像一个动画,作为一个标志,只有5-7秒,比应用程序应该出现,只是一个简单的我认为视频播放器没有按钮没有点击


你能告诉我该怎么做吗?

将你的简介视频文件放在res/raw文件夹中,并将splash布局设置为:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<VideoView
    android:id="@+id/video"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:fitsSystemWindows="true" >
</VideoView>

你想什么时候播放视频?当我第一次打开应用程序时,或者每次应用程序打开时?也可以打开视频?就像游戏上的徽标一样
VideoView videoview = (VideoView) findViewById(R.id.video);
    videoview.setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.intro_splash));
    videoview.setMediaController(null);
    videoview.start();
    videoview.setOnCompletionListener(new OnCompletionListener()
    {
        @Override
        public void onCompletion(MediaPlayer mp)
        {
            startActivity(new Intent(SplashActivity.this,AbcActivity.class));
            finish();
        }
    });