VideoView在Android 4.0及以上版本上不起作用

VideoView在Android 4.0及以上版本上不起作用,android,android-4.0-ice-cream-sandwich,android-videoview,Android,Android 4.0 Ice Cream Sandwich,Android Videoview,我正在运行时创建一个视频视图,如下所示: @Override public View getUIElement(){ if(vv==null){ this.vv = new VideoView(this.getContext()); vv.setVideoURI(Uri.parse(this.url)); mc = new MediaController(this.getContext()); vv.setMedia

我正在运行时创建一个视频视图,如下所示:

@Override
public View getUIElement(){
    if(vv==null){
        this.vv = new VideoView(this.getContext());
        vv.setVideoURI(Uri.parse(this.url));    
        mc = new MediaController(this.getContext());
        vv.setMediaController(mc);  
    }
    return vv;
}
之后,我将这个视频视图添加到LinearLayout,我称之为:

public void initVideo(){
    mc.show();  
    vv.setBackgroundColor(Color.TRANSPARENT);
    vv.requestFocus();
    vv.start(); 
    Log.v("Video",vv.toString());
}
这段代码在Froyo 2.2和Gingerbread 2.3.5上运行得非常好,但在ICS 4.0和JB4.1上什么都没有发生-VideoView甚至在父视图中都不可见。你知道为什么吗? 在Uri.parse中,我将url传递给mp4文件

-编辑
我忘了告诉大家,在ICS和JB中的LogCat中,甚至在Froyo和Gingerbread中都没有调用MediaPlayer,因为MediaPlayer类生成了一些信息。

我正在从res中的原始文件夹获取视频资源。 您也可以使用直接URL。我已经提交了以下代码

写入XML布局文件

VideoView
        android:id="@+id/videoView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"<
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true" />

是的,以防万一你没有注意到-我基本上也是这样做的,只是在运行时,而不是在xml中。[解决]-问题是正确的布局参数。在APICould中,请将代码行放在为videoview设置布局参数的位置。
video = (VideoView) findViewById(R.id.videoView1);
video.setVideoPath("android.resource://com.example.s3project/raw/" +R.raw.bggreen1);
//video.setVideoURI(Uri.parse("http://www.pocketjourney.com/downloads/pj/video/famous.3gp"));
        video.start();