Android:video as splash screen

ε祈祈猫儿з 提交于 2019-12-09 16:57:32

问题


I want to play the video as splash screen.I have implement the play video but it show the default control like play,pause and seek etc.I want to remove the so that the after video finish I need to call the new activity.

 MediaController mc = new MediaController(this);
    getWindow().setFormat(PixelFormat.TRANSLUCENT);
    video.setMediaController(mc);
    video.setVideoURI(uri);
    video.setOnCompletionListener(this);
    video.setOnTouchListener(new OnTouchListener() {

            public boolean onTouch(View arg0, MotionEvent arg1) {
                Toast.makeText(getApplicationContext(), "ontouch",Toast.LENGTH_LONG).show();
                return true;
            }
        }) ;

and the main.xml

Thank in advance.


回答1:


The answer was too simple remove the line

 video.setMediaController(mc);

because i did not want to use the control.

Thank you




回答2:


Disable the touchable property in the layout.xml file:

<VideoView 
android:layout_width="fill_parent" 
android:id="@+id/videoView1" 
android:layout_height="wrap_content" 
android:clickable="false"/>

Hope that helps you

Now there is a Method called

setMediaController(MediaController mCtrl)

http://d.android.com/reference/android/widget/VideoView.html#setMediaController%28android.widget.MediaController%29

You can call this method and pass the argument as MediaController.hide()

Here is a Sample Code:

MediaController controller=MediaController(Context);
controller.hide();
VideoView videoView= (VideoView) findViewById(R.id.videoView1);
videoView.setMediaController(controller);
//try passing null here as well


来源:https://stackoverflow.com/questions/5473553/androidvideo-as-splash-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!