Android: Getting different style softkeyboard - android

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.

Related

Is there a way to show numeric keypad of android but with only selected numbers?

Is there a way to show numeric keypad of android but with only selected numbers?
Like i want to only show the numbers 2,4,6,8..all other numbers and signs should be blocked.
is there a way to do that in android?
Not really. I believe that you have the following options:
Create a custom keyboard
The most important downside is that each of your users would have to select your keyboard from system settings as the default.
Create a view, which looks like a keyboard
Probably the best approach, but the 'keyboard' most likely won't look like the native one.
Handle only the desired keys and ignore other.
If you can show all buttons and handle only a few of them - do that.
From the docs, there is a XML Attribute that should do the trick, but I have not tested it:
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/yourEditTextId"
android:digits="2468"
android:inputType="number" />
The XML Attribute digits, which is inherited from TextView, is described as follows:
If set, specifies that this TextView has a numeric input method and that these specific characters are the ones that it will accept. If this is set, numeric is implied to be true. The default is false.

How to enter special characters in an EditText in Android?

Is there any way to input special characters (which are not present in the default soft keyboard ,eg. theta) in an Android EditText?
Thanks..
Well as per your need, I would like to suggest to create a custom keyboard because the stock keyboard which comes with the device may not have the special characters you need.
You can refer the following tutorial to create a custom keyboard
http://www.fampennings.nl/maarten/android/09keyboard/index.htm
or you can see this search result which may serve your purpose,
https://github.com/search?q=android+custom+keyboard&ref=cmdform
And from below site you can get the list of Unicode characters which Android supports,
http://en.wikipedia.org/wiki/List_of_Unicode_characters
http://unicode-table.com/en/#0026
Note: Writing the whole code to create a custom keyboard is beyond the scope of this answer, so I mentioned the reference link.
What you are going to do is to create a custom keyboard. First thing you want is to hide the default keyboard when an EditText is focused:
getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Now, you must create a custom layout (RelativeLayout or Multiple LinearLayouts this is your desire), create and set text to the buttons that you want to show. Make this keyboard view setVisibility(View.INVISIBLE) or setVisibility(View.GONE), and whenever your EditText is focused, make it setVisibility(View.VISIBLE).
After keyboard is visible, programming the rest is up to you it is practically easy.
If you also need a guide, here is an example.

How do I get the done button to appear on the soft keyboard?

So, I do not see a done button on the soft-keyboard. There is the standard enter key, but from my reading I am lead to believe that there could be/should be a done button (when working with an AutoCompleteTextView at least. I have tried adding the following line to my xml, but to no avail:
android:imeActionLabel="Done"
I know Im missing something pretty huge, what is it?
The answer was to include
android:singleLine="true"
in the xml for the AutoCompleteTextView. This switches the enter key for next if there are multiple edittexts (and done for the last one), or for done if there is only one edittext.
Have a look at this question:
Disable Next button

UPDATE: This is now a Swype related issue: Disable the automatic capitalizing of a sentence's first character in an EditText

I'm implementing an EditText that is used to obtain an rtsp URI from the user. Though it's not a huge issue functionally, I would like to disable the default behavior of the on screen keyboard where the state of the caps key is enabled for the first character of every sentence. From what I've gathered, this cannot be done in the XML via android:inputType flags. Any pointers as to how to do this programatically would be helpful.
I'd like to include the code, but the nature of the project prevents me from doing so. But I can say that nothing fancy is being done here. The EditText itself has no other input flags in use, and the only IME option in place is the flag to disable the Extract UI in landscape. The layout is implemented via XML, not programatically, so there are no custom classes or extensions in the mix either.
EDIT: The android:capitalize constant inherited from TextView isn't working. I'm specifically targetting 2.2 on a Galaxy Tab, so I don't know if this has something to do with Samsung's OS tweaks, or if it has something to do with the capitalize constant being deprecated.
EDIT 2: Swype is the culprit for not allowing the use of the capitalize constant. Does anyone know if there is a way to make Swype play nice without having to inform the end user to disable Swype?
You can use the inherited android:capitalize attribute from TextView. It accepts none (no caps, which is what you want), sentences (capitalizes the first word of each sentence), words (capitalizes the first letter of every word), and character (all caps).
Putting this in the XML for the EditText worked to stop Swype 2.17.59.15552.t100 from forcing capitals:
android:inputType="text|textEmailAddress"
Since EditText is subclass of TextView, you should be able to use the TextView:capitalize configuration to change the capitalization scheme of the view. It looks like you might only be able to set none in xml.

How to add two possible keys in one keyboard button

I've been trying to create my own android keyboard following this guide and looking at the latinIME souce code.
While reading the kbd_qwerty.xml file I noticed the different tags used and explained here. I was expecting to see certain tag to reproduce what BetterKeyboard application does. They draw more than one key on each button. Example.
Are they adding images or this is somehow possible from the xml?
Thanks for reading!
Better Keyboard completely rewrote the onscreen keyboard so they can do what every they want with the layout and key functions. With the default Android keyboard you'll need to stick with one glyph per key. Of course you can always use alt's to get other characters.

Categories

Resources