android - 视频运行时检测屏幕上的触摸

发布于 2024-10-03 07:57:29 字数 583 浏览 0 评论 0原文

我是初学者,有两个问题。

  1. 为什么附加代码中的视频没有运行(从模拟器获取消息,表明应用程序无法运行视频)。

  2. 任何人都可以帮助我了解如何实现 onTouchEvent 以便在视频运行时捕获屏幕上的触摸(不关心屏幕上的位置)。

提前致谢 阿米哈伊

公共类 VidShow 扩展了 Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.videoscrn);

/*run the video*/
VideoView video = (VideoView) findViewById(R.id.video);

// Load and start the movie
video.setVideoPath("raw/samplevideo.3gp" );
video.start();

}

}

I am a beginner and I have two question.

  1. Why does the video in the attached code is not running (get a message from the emulator that the application cannot run the video).

  2. Can anyone please help me to understand how should I implement the onTouchEvent in order to capture a touch on the screen (don't care where on the screen) while a video is running.

Thanks in advance
Amihay

public class VidShow extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.videoscrn);

/*run the video*/
VideoView video = (VideoView) findViewById(R.id.video);

// Load and start the movie
video.setVideoPath("raw/samplevideo.3gp" );
video.start();

}

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅忆 2024-10-10 07:57:29

扩展 VideoView 并实现 VideoView。 onTouchEvent(..)

Extend VideoView and implement VideoView.onTouchEvent(..).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文