我在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(){...}); ? –