How can I change android's default keyboard?
I want numeric keyboard to be shown first and then on clicking ABC in the numeric keyboard, I want to show alphabets keyboard.
Is that possible to implement?
Thanks in advance.
Assuming you're using a TextView for your text input, you simply need to set the inputMethod property.
http://developer.android.com/reference/android/widget/TextView.html#attr_android:inputMethod
As I said in this question, I didn't find any answer to that except if you wrote your own keyboard
You can do that with the word "phone" in inputype property of your EDITTEXT
Use InputType="number" in your edittext
Just implement IME option on your numeric keyboard and once clicked change input type programmatically like this:
EditText editText= (EditText) mView.findViewById(R.id.et_awesome);
editText.setOnEditorActionListener(new EditText.OnEditorActionListener() {
#Override
public boolean onEditorAction(EditText v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_GO) {
editText.setInputType(InputType.TYPE_CLASS_TEXT);
return true;
}
return false;
}
});
EditText on XML:
<EditText
...
android:imeOptions="actionGo"
android:imeActionLabel="ABC"
android:imeActionId="666"
android:inputType="number"/>
Related
I have 2 EditText with id (et_1 and et_2) in a layout, and I set
for et_1
android:imeOptions="actionNext",
android:nextFocusForward="#+id/et_2"
when et_1 gets focus and the the software keyboard shows "Next", and when I click "Next", the focus doesn't go to et_2, but to another EditText in another fragment layout. Why is it this way?
How to make the focus go to et_2?
Thanks.
Try changing,
android:nextFocusForward="#+id/et_2"
to
android:nextFocusDown="#+id/et_2"
I hope it helps!
I had the same problem in one of my apps. What I did instead was have a listener in my activity for when "Next" was pressed and then just manually changed the focus. Like this:
final EditText et_1 = (EditText)findViewById(R.id.et_1);
final EditText et_2 = (EditText)findViewById(R.id.et_2);
// listen on the et_1 EditText
et_1.setOnEditorActionListener(new OnEditorActionListener() {
#Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if(actionId == EditorInfo.IME_ACTION_NEXT) { // "Next was selected"
et_2.requestFocus(); // focus on et_2
}
return true;
}
});
I realised referencing does not hide the keyboard
android:nextFocusDown="#+id/et_2"
To Hide the Keyboard add actionDone
<EditText
android:id="#+id/editTextEnterAmount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter Amount"
android:imeOptions="actionDone"
/>
I am new to Android development. Is it possible to change "Done" button's text on keyboard? If yes, how to do that?
EditText input = new EditText(context);
input.setImeOptions(EditorInfo.IME_ACTION_DONE);
input.setImeActionLabel("My Text", EditorInfo.IME_ACTION_DONE);
Alternatively you can do it in the XML
android:imeActionLabel="My Text"
you can set ImeOptions for textview in xml. their are many as per
this
Link for imeOptions
for example various imeOptions..
actionNone IME_ACTION_NONE.
actionGo IME_ACTION_GO.
actionSearch IME_ACTION_SEARCH.
actionSend IME_ACTION_SEND.
actionNext IME_ACTION_NEXT.
android:imeOptions="actionDone"
use like this:
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionGo"
/>
and call this function to use action:
mInstrunctionEditTxt
.setOnEditorActionListener(new OnEditorActionListener() {
#Override
public boolean onEditorAction(TextView v, int actionId,
KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_GO) {
// do what action you want
}
return false;
}
});
I want to hide soft keyboard on EditText even on 'click' also. I mean to say there should not be visible soft keyboard in my activity, because I am having own keyboard to enter data.
Please help me... Thanks...
editText_input_field.setOnTouchListener(otl);
private OnTouchListener otl = new OnTouchListener() {
public boolean onTouch (View v, MotionEvent event) {
return true; // the listener has consumed the event
}
};
source : how to block virtual keyboard while clicking on edittext in android?
Set EditText widget's inputType to null like this,
editTExt.setInputType(TYPE_NULL);
paste below code in your xml file under edittext tag
android:textIsSelectable="true"
Can anyone tell me how to disable and enable the Enter key in the soft keyboard?
just go to your xml and put this attribute in EditText
android:singleLine="true"
and your enter key will be gone
Attach OnEditorActionListener to your text field and return true from its onEditorAction method, when actionId is equal to IME_ACTION_DONE. This will prevent soft keyboard from hiding:
EditText txtEdit = (EditText) findViewById(R.id.txtEdit);
txtEdit.setOnEditorActionListener(new OnEditorActionListener() {
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
// your additional processing...
return true;
} else {
return false;
}
}
});
Refer this LINK.
Try this, together imeOptions = actionDone
<EditText
android:id="#+id/edittext_done"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:imeOptions="actionDone"
android:maxLines="1"/>
In the EditText's layout put something like this:
android:digits="abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ,"
You can also enumerate the rest of the symbols that you would like to be able to enter there, but not the enter key.
I know this question is quite old but an easy way of disabling the enter key is to set android:maxLines="1" in your EditText.
I have One AutocompleTextView and I want to make the virtual keyboard disappear when he hits "DONE" at the AutocompleTextView. So far, the buttons "NEXT"/"DONE" do nothing at all. Any ideas?
Add this Property to your AutoCompleteTextView in xml:
android:imeOptions="actionDone"
The following works for all the Views which support imeOptions; for instance EditText, TextView, AutocompleteTextView, etc.
In your xml:
<autocompleteTextView
inputType = "text"
imeOptions = "actionDone"
/>
In Java:
autocomplete = (AutoCompleteTextView) issueDetailView.findViewById(R.id.yourId);
autocomplete.setOnEditorActionListener(new TextView.OnEditorActionListener() {
#Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if(actionId== EditorInfo.IME_ACTION_DONE) {
//do Whatever you Want to do
}
return true;
}
});
Just add the following on yours XML layout file:
android:imeOptions="actionDone"
android:singleLine="true"
Check android:imeOptions attribute.
In my case android:imeOptions only works if i set android:inputType which is
android:inputType="textAutoComplete" android:imeOptions="actionDone"