我需要使用视频作为我的背景.首先,我将视频文件放在drawable文件夹中,并LinearLayout在main.xml中作为后台调用.但在运行应用程序时,我只看到了黑屏.然后我尝试使用VideoView并调用它如下:
<VideoView
android:id="@+id/video"
android:layout_width="320px"
android:layout_height="240px"
android:layout_gravity="center"
android:background="@raw/hp"/>
Run Code Online (Sandbox Code Playgroud)
在我的活动文件中,我使用以下代码片段调用它:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
VideoView video=(VideoView) findViewById(R.id.video);
video.start();
}
Run Code Online (Sandbox Code Playgroud)
但我仍然没有收到视频文件.我的主要建议是使用气泡视频作为背景,并在其上放置两个气泡按钮,让用户感觉像水景屏幕.谁能帮我?
我想从res文件夹中使用的视频文件.不是来自SD卡或任何外部媒体文件夹.
我已经制作了一个应用程序以及一个名为世界时钟的小部件.
但我不知道如何集成两者,我的意思是将小部件与应用程序集成.我想我必须做出一些明显的改变.但我对此完全失明.我需要一些帮助.
我在android中有以下类,我在其中定义了一些函数来计算屏幕上Bubbles的运动.
public class floatBubble {
private Bitmap img; // the image of the ball
private int coordX = 512; // the x coordinate at the canvas
private int coordY = 600; // the y coordinate at the canvas
private int id; // gives every ball his own id, for now not necessary
private static int count = 1;
private boolean goRight = true;
private boolean goDown = true;
public floatBubble(Context context, int drawable) {
BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inJustDecodeBounds …Run Code Online (Sandbox Code Playgroud)