我不知道为什么我无法在VideoView中播放视频。我收到的消息是:无法播放视频:很抱歉,无法播放此视频。我也为模拟器创建了SD卡。我需要将SD卡放在SDK的特定文件夹中吗?请评论。这是布局:<?xml version="1.0" encoding="utf-8"?><LinearLayout android:id="@+id/LinearLayout01" android:layout_height="fill_parent" android:paddingLeft="2px" android:paddingRight="2px" xmlns:android="http://schemas.android.com/apk/res/android" android:paddingTop="2px" android:paddingBottom="2px" android:layout_width="fill_parent" android:orientation="vertical"> <VideoView android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/VideoView" /></LinearLayout>这是代码:package com.examples.videoviewdemo;import android.app.Activity;import android.os.Bundle;import android.widget.MediaController;import android.widget.VideoView;public class VideoViewDemo extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); VideoView videoView = (VideoView)findViewById(R.id.VideoView); //MediaController mediaController = new MediaController(this); // mediaController.setAnchorView(videoView); //videoView.setMediaController(mediaController); videoView.setVideoPath("/sdcard/blonde_secretary.3gp"); videoView.start(); }}等待回复...
3 回答
神不在的星期二
TA贡献1963条经验 获得超6个赞
我的猜测是您的视频与Android不兼容。尝试其他视频。这个绝对可以在Android上使用(但由于某些原因,不能在较新的设备上使用)。如果该视频正常,而您的视频不正常,则说明您的视频与Android不兼容。
正如其他人指出的那样,请在设备上对此进行测试。在模拟器上播放视频需要太多功率。
动漫人物
TA贡献1815条经验 获得超10个赞
让videoView您的活动类的成员变量,而不是保持它作为本地的的onCreate功能:
VideoView videoView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
videoView = (VideoView)findViewById(R.id.VideoView);
videoView.setVideoPath("/sdcard/blonde_secretary.3gp");
videoView.start();
}
- 3 回答
- 0 关注
- 632 浏览
添加回答
举报
0/150
提交
取消