!752 import android.app.*; import android.widget.*; import android.view.*; import android.view.KeyEvent; import android.view.inputmethod.*; import android.text.*; static Activity androidContext; p { androidContext.runOnUiThread(runnable { Activity context = androidContext; LinearLayout ll = new LinearLayout(context); ll.setOrientation(ll.VERTICAL); final TextView tv = new TextView(context); tv.setText("Hello\nworld"); tv.setBackgroundColor(0xFFFFFFCC); ScrollView sv = new ScrollView(context); sv.setBackgroundColor(0xFFFFFFCC); sv.addView(tv); //sv.setGravity(Gravity.FILL_VERTICAL); sv.setLayoutParams(new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f)); ll.addView(sv); final EditText et = new EditText(context); et.setInputType(InputType.TYPE_CLASS_TEXT); // Hopefully turns off multiline et.setOnEditorActionListener(new TextView.OnEditorActionListener() { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) { tv.setText("Yo: " + et.getText()); } return false; } }); ll.addView(et); context.setContentView(ll); }); }