我在Adobe AIR中使用Android ANE插入VideoView以观看视频。问题是,一旦添加视频,屏幕的其余部分不可点击。WebView下的不可触摸项目
这里是用来插入VideoView代码:
// File: VideoPlayerTestActivity.java
protected void onCreate(Bundle savedInstance)
{
super.onCreate(savedInstance); // always call this
VideoView videoHolder = new VideoHolder(this);
this.programaticallyAddToLayout(videoHolder);
// Add the media controllers at bottom of video, instead of screen bottom
videoHolder.setOnPreparedListener(new OnPreparedListener() {
public void onPrepared(MediaPlayer mp) {
mp.setOnVideoSizeChangedListener(new OnVideoSizeChangedListener() {
public void onVideoSizeChanged(MediaPlayer mp, int width, int height) {
MediaController mc = new MediaController(VideoPlayerTestActivity.this);
videoHolder.setMediaController(mc);
mc.setAnchorView(videoHolder);
}
});
}
});
videoHolder.setMediaController(new MediaController(this));
videoHolder.setVideoURI(Uri.parse(mediaURL));
videoHolder.requestFocus();
videoHolder.start();
}
这里是法programaticallyAddToLayout(),它创建了应该在XML布局中的代码。 (我不使用XML布局文件,对,the app cannot find the xml file某种原因,仍然令我困惑不解):
private void programaticallyAddToLayout(VideoView videoView)
{
FrameLayout layout = new FrameLayout(this);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(800, 600);
layoutParams.gravity = Gravity.CENTER;
layout.setId(1);
layout.setLayoutParams(layoutParams);
videoView.setId(2);
layout.addView(videoView, layoutParams);
this.setContentView(layout);
}
这里是应用程序的screengrab,以供参考:
你想要点击哪个部分? 你想要的东西像thatbutton1.setOnClickListener(新的OnClickListener(){...}); ? –