Code example for FrameLayout

Methods: addView, setLayoutParams

0
			 
            // FrameLayout 
            ViewGroup.LayoutParams framelayout_params =
                new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                                           ViewGroup.LayoutParams.FILL_PARENT);
            FrameLayout framelayout = new FrameLayout(this);
            framelayout.setLayoutParams(framelayout_params);
 
            // Cocos2dxEditText layout 
            ViewGroup.LayoutParams edittext_layout_params =
                new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                                           ViewGroup.LayoutParams.WRAP_CONTENT);
            Cocos2dxEditText edittext = new Cocos2dxEditText(this);
            edittext.setLayoutParams(edittext_layout_params);
 
            // ...add to FrameLayout 
            framelayout.addView(edittext);
 
            // Cocos2dxGLSurfaceView 
	        mGLView = new Cocos2dxGLSurfaceView(this);
 
            // ...add to FrameLayout 
            framelayout.addView(mGLView);
 
	        mGLView.setEGLContextClientVersion(2);
	        mGLView.setCocos2dxRenderer(new Cocos2dxRenderer());
            mGLView.setTextField(edittext);
 
            // Set framelayout as the content view 
			setContentView(framelayout);
		} 
		else { 
			Log.d("activity", "don't support gles2.0");
			finish(); 
		}