TextField in RelativeLayout

TextField in RelativeLayout
0.0 0


I created RelativeLayout and set it to contentview. In this layout I moved GLSurfaceView and TextField.

        mGLView = (Cocos2dxGLSurfaceView) findViewById(R.id.helloworld_gl_surfaceview);

        //before add to layout remove it from actual parent
        ViewGroup vg = (ViewGroup)(mGLView.getParent());

    EditText editText = (EditText)findViewById(R.id.textField);

        mLayout = new RelativeLayout(this);        
        setContentView(mLayout, new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));

This mLayout I use for add/remove videoPlayer or webView, but I have problem with TextField from Cocos2dx.
After confirm text editing it stay on screen (see screenShot left top corner).

If I set mTextField.setVisible(INVISIBLE) after event HANDLER_CLOSE_IME_KEYBOARD it no again appear.

snap20111125_134417.png (52.8 KB)


So solution is really easy. I forgoted FIRST show textField :).

  if (null != mTextField) {
    mTextField.setVisibility(VISIBLE);//show first

    if (mTextField.requestFocus()) {//then test




Did playing video work correctly?
Could you share it with us?
Somebody had asked me for how to play video.


Yes, share it please! :slight_smile:


I am not able to play video from assets directory only from raw, sdcard and internet.


Milda, what do you mean saying “raw” or sdcard? What exactly formats can you support playing video?


You can see here the format suported http://developer.android.com/guide/appendix/media-formats.html .
If you use videoviewer widget


What I wrote, it was places from where, I am able to play video. Formats are mentioned in link above.

Raw is special folder in res directory.
SdCard is external storage on memory card.