android addView z order

不知起什么名 2018-03-01 10:32:26

// 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);

在onCreate初始化并创建 mFrameLayout , mGLSurfaceView


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);


在程序运行过程中,运行上面的代码2,添加 mVideoView

android 8 是 mVideoView 显示在顶层,其它系统 mVideoView 显示在底层,请问原因是?
...全文
708 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
jklwan 2018-03-08
  • 打赏
  • 举报
回复
mFrameLayout.addView(mVideoView,mFrameLayout.getChildCount());

80,337

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧