Note that there are some explanatory texts on larger screens.

plurals
  1. POandengine: Add a view containing UI controls on top of andengine using addContentView
    primarykey
    data
    text
    <p>I am trying to create an EditText on top of an andengine game to act as an ingame chatbox. The method I am using <strong>works fine on Android 2.2.1 IDEOS 2, Emulator Android 2.1, Emulator Android 2.2, Emulator Android 2.3</strong>.</p> <p><strong>UPDATE 25/APR/2012</strong>: Recently tested on Samsung Galaxy S SGH-T959 Android 2.1-Update1, it is working fine except for minor alignment issues, is this a problem of Android 2.3 on Samsung.</p> <p>The following devices <strong>do not display the EditText control</strong> on top of the andengine game activity:</p> <ol> <li>Samsung Y S5360 Android 2.3.6 </li> <li>Samsung Galaxy 551 Android 2.3.6</li> </ol> <p>This is what I am doing in Game Activity</p> <pre><code>chatEditText = new EditText(this); chatEditText.setSingleLine(true); chatEditText.setId(1); chatEditText.setHint(" "); tableLayout = new TableLayout(this); tableLayout.setVerticalGravity(Gravity.BOTTOM); tableLayout.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); tableLayout.setHorizontalGravity(Gravity.CENTER_HORIZONTAL); tableLayout.setPadding(25, 25, 25, 308); tableLayout.addView(chatEditText); LayoutParams lp = new ViewGroup.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); this.addContentView(tableLayout, lp); tableLayout.setVisibility(View.GONE); </code></pre> <p>To show/ hide the control I am setting its visibility to View.VISIBLE or View.GONE as required using a Handler.</p> <p>The above works on an IDEOS 2 Android 2.2.1 and emulators but not on Samsung Galaxy 551, Samsung Galaxy S 5360, other devices needs to be tested. Please help.</p> <p>The above method was described here: <a href="http://www.andengine.org/forums/gles1/type-a-phrase-in-game-t3279-10.html#p15532" rel="noreferrer">AndEngine forum, display UI in andengine</a> Another method was suggested, where a Popup dialog box will display the EditText here <a href="https://github.com/aliHafizji/AndEngineHelperClasses/blob/master/src/org/andengine/helperclasses/InputText.java" rel="noreferrer">AndEngine helper class Input Text</a>, but that is not suitable for my usecase.</p> <p>Would like to use standard EditText, else the only way out looks like implementing own fake keyboard and fake input sprite in AndEngine, with limitation that Hardware and International keyboards may not be available. Any help will be appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload