nicolasgramlich / AndEngine

Free Android 2D OpenGL Game Engine
http://www.andengine.org
Apache License 2.0
3.18k stars 1.35k forks source link

the problem of combination andengine and android-view #133

Open blissoft opened 12 years ago

blissoft commented 12 years ago

hi~ I'm the android -2d-game developer lived in Korea.

I have troble making game with andengine. And the game root-activity is LayoutGameActivity.

in MainActivity.java

@Override public void onClick(ButtonSprite pButtonSprite, float pTouchAreaLocalX, float pTouchAreaLocalY) { // TODO Auto-generated method stub

if(pButtonSprite.equals(btn)) { this.runOnUiThread(new Runnable(){

@Override public void run() { // TODO Auto-generated method stub EditText edit_text=(EditText)findViewById(R.id.edit_text); edit_text.setVisibility(View.VISIBLE); }

});

} }

in main.xml

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent">

<org.andengine.opengl.view.RenderSurfaceView android:id="@+id/xmllayoutexample_rendersurfaceview" android:layout_width="fill_parent" android:layout_height="fill_parent"/>

<EditText android:id="@+id/edit_text" android:layout_width="fill_parent" android:gravity="bottom" android:layout_gravity="bottom" android:visibility="invisible" android:layout_height="wrap_content"/>

and as you know, I added the 'EditText' in main.xml .And in game, I want to EditText to visible.

But the edittext is not visible.Though the virtual-keyboard pop-up, the edittext is not visible.

And I attach the video of this problem.

www.youtube.com/watch?v=gj8FmEUBvaY

Niffy commented 12 years ago

The problem is with your XML Layout.

See my post for the XML. To solve the wrapping (where its shifting everything up on the click)

http://www.andengine.org/forums/features/fragmentactivty-and-fixedstepmaxfpsengine-t8168.html

For the edit text change android:visibility="invisible" to android:visibility="visible"

blissoft commented 12 years ago

I do not think that invisible editbox problem is because of "android:visibility="invisible" as you comment.

I make editbox visible on "public void onClick()" that you can see code I write down on my post.

Thanks for your comment. However, I am using gles2 which does not support fragment things.

If you check movie what I linked, I related with little bit covered with keyboard which not visible things.

Cheers

Niffy commented 12 years ago

Fragments are supported in my branch (it gles 2) checkout my github bio or the link. In the link is some xml, that should help. Give the xml a try.

blissoft commented 12 years ago

ok..

Could you show me the simple-example?

thanks.

mkonecny commented 9 years ago

@Niffy I can't seem to find the Fragment support in your repository or this one. AFAIK, it was available in 2011 in the "Fragment" branch on Google Code, but appears to be deleted on Github:

https://code.google.com/p/andengine/source/browse/src/org/anddev/andengine/ui/fragment/compat/BaseGameFragment.java?r=0d0d2bcda2941e5b6bf6b56a42dffbc4693fb96e