Set a video as background

前端 未结 3 1076
孤独总比滥情好
孤独总比滥情好 2020-12-12 20:51

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

3条回答
  •  一生所求
    2020-12-12 21:33

    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

提交回复
热议问题