80,349
社区成员
发帖
与我相关
我的任务
分享
// FrameLayout
ViewGroup.LayoutParams framelayout_params =
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
mFrameLayout = new FrameLayout(this);
mFrameLayout.setLayoutParams(framelayout_params);
// Cocos2dxEditText layout
ViewGroup.LayoutParams edittext_layout_params =
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
Cocos2dxEditText edittext = new Cocos2dxEditText(this);
int oldImeOptions = edittext.getImeOptions();
edittext.setInputType(EditorInfo.TYPE_CLASS_TEXT);
edittext.setImeOptions(oldImeOptions | EditorInfo.IME_ACTION_NEXT );
oldImeOptions = edittext.getImeOptions();
edittext.setImeOptions(oldImeOptions | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
//oldImeOptions = this.mInputEditText.getImeOptions();
edittext.setLayoutParams(edittext_layout_params);
// ...add to FrameLayout
mFrameLayout.addView(edittext);
// Cocos2dxGLSurfaceView
this.mGLSurfaceView = this.onCreateView();
// ...add to FrameLayout
mFrameLayout.addView(this.mGLSurfaceView);
// Switch to supported OpenGL (ARGB888) mode on emulator
if (isAndroidEmulator())
this.mGLSurfaceView.setEGLConfigChooser(8 , 8, 8, 8, 16, 0);
this.mGLSurfaceView.setCocos2dxRenderer(new Cocos2dxRenderer());
this.mGLSurfaceView.setCocos2dxEditText(edittext);
// Set framelayout as the content view
setContentView(mFrameLayout);
mVideoView = new IjkVideoView(WelkinNine.this,
luaCallbackFunction);
Pair<Integer, Integer> res = ScreenResolution
.getResolution(WelkinNine.this);
int windowWidth = res.first.intValue(), windowHeight = res.second
.intValue();
// System.out.println("[BJL:video] playVideo" + bottomPer);
// System.out.println("[BJL:video] playVideo"
// + Math.round(windowHeight * heightPer));
// System.out.println("[BJL:video] playVideo"
// + Math.round(leftPer * windowWidth));
// System.out.println("[BJL:video] playVideo" +
// windowHeight);
// System.out.println("[BJL:video] playVideo"
// + Math.round(windowHeight * bottomPer));
FrameLayout.LayoutParams cameraFL = new FrameLayout.LayoutParams(
windowWidth, Math.round(windowHeight * heightPer),
Gravity.TOP); // set size
cameraFL.setMargins(Math.round(leftPer * windowWidth),
Math.round(windowHeight * bottomPer), 0, 0); // set
// position
mVideoView.setLayoutParams(cameraFL);
mVideoView.setLayerSize(windowWidth,
Math.round(windowHeight * heightPer));
// mVideoView.setEnabled(false);
mFrameLayout.addView(mVideoView);