将视频设置为背景 [英] Set a video as background

查看:282
本文介绍了将视频设置为背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的Android应用创建登录屏幕,并且想知道如何将视频用作背景,而不是具有图像或简单的颜色?

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?

我想使其类似于Spotify/Bible应用程序登录屏幕,在该屏幕上,他们正在播放视频,并且您具有用于登录或注册的按钮.

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.

图片-

(点击图片放大)

推荐答案

您只需要几个步骤即可将视频设置为应用程序的背景.

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

  1. 创建视频视图,并确保它占据整个区域.如果您使用约束布局,则需要将视频视图的所有约束设置为父级.
  2. 在"res"目录下创建一个名为"raw"的新目录
  3. 将视频文件放入原始"目录
  4. 播放视频
  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();

我制作了一个视频,解释了如何在android中创建JOOX登录屏幕,该屏幕看起来或多或少类似于Spotify应用.随时检查一下,让我知道是否有帮助:)

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

这篇关于将视频设置为背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆