Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
220 views
in Technique[技术] by (71.8m points)

android - Set a video as background

I am making a login screen for my Android app and was wondering how can I use a video as a background rather than having an image or simple colors?

I want to make it similar to the Spotify / Bible app login screen where they have a video playing and you have buttons to sign in or register.

Images -

(Click image to enlarge)

IMG:

IMG:

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You just need a few steps to set the video as the background of your app.

  1. Create a video view and make sure it takes up the whole area. If you are using constraint layout, you need to set all the constraints of your video view to parent.
  2. Create a new directory called "raw" under your "res" directory
  3. Place your video file into the "raw" directory
  4. Play the video
    VideoView videoview = (VideoView) findViewById(R.id.videoview);
    Uri uri = Uri.parse("android.resource://"+getPackageName()+"/"+R.raw.test);
    videoview.setVideoURI(uri);
    videoview.start();
    
    I have made a video that explains how to create JOOX login screen in android which looks more or less like the Spotify app. Feel free to check it out and let me know if it helps :)

https://youtu.be/tPeDn18FrGY


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...