// ===========================================================
  // Methods
  // ===========================================================
  public void init() {

    // 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);
    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);
  }
Example #2
0
  // ===========================================================
  // Methods
  // ===========================================================
  public void init() {

    // 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
    this.mGLSurfaceView = this.onCreateView();

    // ...add to FrameLayout
    framelayout.addView(this.mGLSurfaceView);

    this.mGLSurfaceView.setCocos2dxRenderer(new Cocos2dxRenderer());
    this.mGLSurfaceView.setCocos2dxEditText(edittext);

    // Set framelayout as the content view
    setContentView(framelayout);
  }