I have an EditText in my layout file. When I click(focus) on EditText a soft keyboard appear contains predictive word in keyboard suggestion bar(see figure 1).
Figure 1
But I want that when I will click on my EditText keyboard will appear with no suggestion bar and with an extra number row(see Figure 2).
Figure 2
I already tried some answer saying that adding below attribute will do that but none of them seems worked for me.
inputType="text|textNoSuggestion",inputType="textFilter" not worked.The below code work but also open a secure keyboard.(oppo,vivo phone built in feature)
inputType="textNoSuggestion|textVisiblePassword"
Is there any solution to make it done without opening secure keyboard?
N.B. I don't wanna disable the secure keyboard.
I saw this feature on some code editing application available on playstore.
In my application I my getting different style soft keyboard for ex at one part of my app I am getting this
and at other part
but I want it to be same for all.
This is the same keyboard with just different action button. So you are basically looking for
android:imeOptions
as documented here: http://developer.android.com/reference/android/R.attr.html#imeOptions
This particular difference is due to the fact that, one of your EditText (text boxes are called EditTexts in Android) is a single line one, where the other is not. Set the property
android:lines="1"
in your EditTex's xml tag, and you will see second keyboard for all such EditTexts. But as #Marcin answered, learn the input types correctly, and you will find the differences between them.
in my app I disabled the keyboard (I use now my custom keyboard) using this code:
editText.setInputType(InputType.TYPE_NULL);
Now, my problem is that the text cursor does not appear anymore in the edit text. What should I do? Any suggestion would be very appreciated.
There is an Issue opened in bug tracker Issue opened in bug tracker for this.
One of the users suggests the approach which works on "most" devices.
Briefly, all you have to do is call:
editText.setRawInputType(InputType.TYPE_CLASS_TEXT);
for your EditText view (after you called editText.setInputType(InputType.TYPE_NULL);).
You should probably also set:
editText.setTextIsSelectable(true);
in order for text to be selectable (though in does not seem to work properly with Samsung Galaxy SIII). This method is only available starting from HONEYCOMB (api11) so keep that in mind when developing for older Android versions.
Also it is stated that your EditText should not be the first view to receive focus when activity starts (if it is - just requestFocus() from another view). Though I (personally) have not experienced any problems with this.
Rather than just using a custom view for your custom keyboard, why not implement a full-fledged IME? That will solve your cursor problem, and even make your keyboard available outside your app (if you want).
This answer has a couple useful links if you want to do that:
How to develop a soft keyboard for Android?
I really wouldn't suggest this. Writing a good full fledged IME is really hard. In addition, users come to expect functionality from their keyboard (auto-correct, Swyping, next word prediction, the ability to change languages) that you won't have unless you spend months on the keyboard itself. Any app that wouldn't allow me to use Swype would immediately be removed (bias note: I worked on Swype android).
But if you want to integrate fully with the OS as a keyboard, you're going to have to write an InputMethodService. Your keyboard would then be selectable by the user in the keyboard select menu, and usable for any app. That's the only way to get full OS integration, otherwise you'll need to really start from scratch- writing your own EditView. Have fun with that, getting one that looks nice is decidedly non-trivial.
Also, setting input type null won't disable most keyboards. It just puts them into dumb mode and turns off things like prediction.
I tried the below answer and it worked, but take care that
1) EditText must not be focused on initialization
2) when your orientation changes while the user's focus is on the editText, the stock keyboard pops up, which is another "solvable" problem.
This was mentioned in a previous answer but take care that you MUST make sure your editText element do not get focus on instantiation:
https://code.google.com/p/android/issues/detail?id=27609#c7
#7 nyphb...#gmail.com
I have finally found a (for me) working solution to this.
First part (in onCreate):
mText.setInputType(InputType.TYPE_NULL);
if (android.os.Build.VERSION.SDK_INT >= 11 /*android.os.Build.VERSION_CODES.HONEYCOMB*/) {
// this fakes the TextView (which actually handles cursor drawing)
// into drawing the cursor even though you've disabled soft input
// with TYPE_NULL
mText.setRawInputType(InputType.TYPE_CLASS_TEXT);
}
In addition, android:textIsSelectable needs to be set to true (or set in onCreate) and the EditText must not be focused on initialization. If your EditText is the first focusable View (which it was in my case), you can work around this by putting this just above it:
<LinearLayout
android:layout_width="0px"
android:layout_height="0px"
android:focusable="true"
android:focusableInTouchMode="true" >
<requestFocus />
</LinearLayout>
I saw many question where programmer are facing problem when soft keypad display or disappear. But my problem seems unique. I do not face any problem at the time of display or when soft keypad goes. I face problem when user enter first character. At that time i think because of Blue preview of character on top of soft keypad it is pushing my layout little bit up. Can some one tell me how can i get rid of it ?
Sounds like you might not have adjustResize set for windowSoftInputMode in your activity declaration. Posting your layout XML and your AndroidManifest would be relevant.
I've got a small Android app that I am developing and I have an EditText element which does not like to display it's contents while the keyboard is on the screeen.
For example I touch the editTextbox and it brings up the keyboard, pressing a letter, say a displays a in the textbox, but after that no new text shows up so the user is essentially typing blind from that point on.
This only happens on the device and not in the emulator. Vodafone 845 if it makes any difference.
The code I am using for the EditText is this.
<EditText
android:id="#+id/EditAddress"
android:layout_width="200px"
android:singleLine="True"
android:hint="Address or Landmark"/>
I did have a OnKeyListener and an OnClickListener, but removing them from the code makes no changes to the behaviour. The EditText is also inside of a TableLayout which is inside of another TableLayout. This is the only EditText that is behaving badly on the device. (I have not coded any others in the application. But might add some just to find out whats wrong.
EDIT: Ok, it seems to be caused if the keyboard obscures the location of the original editbox such that the view has to scroll down so the editbox will not be covered by the software keyboard. For now I can rearrange my page so the edit box is at the top. But this is a bit of a hacky solution. Anyone know what causes this and/or how to fix it.
I think you need to give it a layout_height as well. Even if it is wrap_content or the like.