视频视图不可见
我需要将 VideoView
添加到 LinearLayout
,然后将 LinearLayout
添加到 ViewFlipper
。这是我的代码:
LinearLayout l = new LinearLayout(this);
l.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
l.setOrientation(LinearLayout.VERTICAL);
myVideoView = new VideoView(this);
myVideoView.setVideoPath(files[i].getPath());
myVideoView.requestFocus();
myVideoView.setLayoutParams(new LayoutParams(
l.getWidth(), l.getHeight()));
myVideoView.setKeepScreenOn(true)
myVideoView.start();
myVideoView.setId(i);
l.addView(myVideoView);
vf.addView(l);
问题是我看到所有屏幕都是白色的并听到视频的声音,因为视频正在播放但我看不到它。为什么?问题出在哪里?
编辑:
如果我让它
myVideoView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
工作,但视频速度并不慢,当图像出现时,它会突然出现。我希望那个视频像这样慢慢出现然后消失。
I need to add a VideoView
to a LinearLayout
, and then to add LinearLayout
to ViewFlipper
. Here is my code :
LinearLayout l = new LinearLayout(this);
l.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
l.setOrientation(LinearLayout.VERTICAL);
myVideoView = new VideoView(this);
myVideoView.setVideoPath(files[i].getPath());
myVideoView.requestFocus();
myVideoView.setLayoutParams(new LayoutParams(
l.getWidth(), l.getHeight()));
myVideoView.setKeepScreenOn(true)
myVideoView.start();
myVideoView.setId(i);
l.addView(myVideoView);
vf.addView(l);
The problem is that I see all screen white and hear the video's sound, because video is playing but I don't see it. Why? Where is the problem?
EDIT :
if I put
myVideoView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
it works but the video is not coming slow, as image appear, it appears suddenly. I want that video to appear slowly and to dissapear like this to.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个:
...
Try this:
...
注释 myVideoView.setKeepScreenOn(true) 行并检查一次。
comment the line myVideoView.setKeepScreenOn(true) and check once.