Creating a SoftKeyboard with Multiple/Alternate characters per key

Implementing alternate key popup: For each key you wish to have a popup keyboard you should define popupCharacters and popupKeyboard: /res/xml/[Keyboard].xml <Key android:keyLabel=”(” android:popupKeyboard=”@xml/keyboard_popup_template” android:popupCharacters=”[{&lt;” /> The popupKeyboard is an XML representation of the keyboard used in the popup containing the alternate keys: /res/xml/keyboard_popup_template.xml <Keyboard xmlns:android=”http://schemas.android.com/apk/res/android” android:keyWidth=”10%p” android:horizontalGap=”0px” android:verticalGap=”0px” android:keyHeight=”56dp”> </Keyboard> Styling the alternate key … Read more

Use “ENTER” key on softkeyboard instead of clicking button

You do it by setting a OnKeyListener on your EditText. Here is a sample from my own code. I have an EditText named addCourseText, which will call the function addCourseFromTextBox when either the enter key or the d-pad is clicked. addCourseText = (EditText) findViewById(R.id.clEtAddCourse); addCourseText.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) … Read more

adjustPan not preventing keyboard from covering EditText

After doing a lot of searching apparently it’s what I’m calling a bug. If you use the fullscreen tag (to remove the status bar from the activity) you can’t use “adjustResize” without wrapping the activity in a ScrollView. Unfortunately for me I’m using a ListView which would create yet another problem. I’m sick of messing … Read more

How to adjust layout when soft keyboard appears

Just add android:windowSoftInputMode=”adjustResize” in your AndroidManifest.xml where you declare this particular activity and this will adjust the layout resize option. some source code below for layout design <?xml version=”1.0″ encoding=”utf-8″?> <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical” > <TextView android:id=”@+id/textView1″ android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_centerHorizontal=”true” android:layout_marginTop=”20dp” android:text=”FaceBook” android:textAppearance=”?android:attr/textAppearanceLarge” /> <EditText android:id=”@+id/editText1″ android:layout_width=”match_parent” android:layout_height=”wrap_content” android:layout_below=”@+id/textView1″ android:layout_marginTop=”30dp” android:ems=”10″ android:hint=”username” > <requestFocus … Read more

How to show soft-keyboard when edittext is focused

To force the soft keyboard to appear, you can use EditText yourEditText= (EditText) findViewById(R.id.yourEditText); yourEditText.requestFocus(); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(yourEditText, InputMethodManager.SHOW_IMPLICIT); And for removing the focus on EditText, sadly you need to have a dummy View to grab focus. To close it you can use InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(yourEditText.getWindowToken(), 0); This works … Read more