Android Keyboard style with OK Button - android

I am creating an app and I need help.
I want to create a EditText and when the user open the keyboard to fill the edit text, that keyboard must have the "OK"or "Done" button inside it.
Example:
Thank you so much

You need to use ime options action done
You need to use single line (although deprecated)
example:
<EditText
android:id="#+id/saveDialogEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:digits="abcdefghijklmnopqrstuvwxyz1234567890-_ ."
android:hint="#string/enter_palette_name_hint"
android:imeOptions="actionDone"
android:inputType="textAutoComplete"
android:singleLine="true"/>

Related

Android: How to remove customize keyboard button from keyboard?

Please find below the screenshot wherein the circular box shows the customize button option.
XMl Code:
<EditText
android:id="#+id/et_cost_per_mile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:hint="Cost Per Mile(₤)"
android:inputType="numberSigned"
/>
All I want to remove :: button from keyboard.
You have change input type like..
android:inputType="phone"
You can not. This is your android keyboard app and you cant change it. The keyboard settings can be modified in the android settings. But obviously it depends on the user, not the developer.
The only way I think it will allow you to do that is that you include in your app a fake numeric keypad as a layer (Similar to the keyboard that appears when you have to type the pin of the app of your bank). However, I don't think this is worth it. With...
android:inputType = "numberSigned"
you are already blocking the user from entering letters or other characters, even if they change their keyboard.

How can enable the "Copy-paste" menu in EditText?

I worked with editText in Android, but when i want select,copy or paste text/number inside of ediTText it's impossible,that is to say, if I pressing (Long press) don't show the menu to select "paste" or anything.
The code from my xml file (EditText) is the next:
<com.rengwuxian.materialedittext.MaterialEditText
android:id="#+id/titulo_articulo_periodico"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:maxLines="1"
android:inputType="text"
android:singleLine="true"
android:textIsSelectable="true"
android:hint="#string/periodico_hint1"
android:textColor="#color/text_color"
app:met_primaryColor="#color/refresco"
app:met_clearButton="true"/>
I work with "Material EditText" library (github: https://github.com/rengwuxian/MaterialEditText) but I don't see difference between my code and the owner code, my friend tell me than i need use onActionItemClicked in every editText, but with this code my Java code is too long. I don't know what do, I'm tired. :(
I think there is no short way of doing it. You have to use Clipboard Manager, And have a lengthy way of implementing the functionality. I am still looking for a simple solution to this. until then refer this link
https://developer.android.com/guide/topics/text/copy-paste.html

How to make Android EditText expand vertically when full

I have this EditText
<EditText
android:layout_width="match_parent"
android:layout_height="72dp"
android:hint="#string/write_message"
android:textColorHint="#color/primary_color"
android:ems="10"
android:imeOptions="actionDone"
android:inputType="textImeMultiLine"
android:id="#+id/message_input"
android:layout_gravity="center_horizontal"
android:backgroundTint="#color/primary_color"/>
When the box is filled up with user inputted text, it scrolls to the right to make room for more text, I do not like this behavior, and would prefer it if the EditText box expanded upwards when it needs more room? Is there a way to do this? Thanks.
Yes, this actually involves two things:
Making the EditText accept multi-line input.
Having its height grow as more text lines are added.
Therefore, to achieve this, you need to set up:
android:inputType="textMultiLine"
android:layout_height="wrap_content"
(Be mindful of the difference between textMultiLine and textImeMultiLine).
The full XML snippet would be:
<EditText
android:layout_width="match_parent"
android:inputType="textMultiLine"
android:layout_height="wrap_content"
android:hint="#string/write_message"
android:textColorHint="#color/primary_color"
android:ems="10"
android:imeOptions="actionDone"
android:id="#+id/message_input"
android:layout_gravity="center_horizontal"
android:backgroundTint="#color/primary_color"/>
Use both flags: textMultiLine will wrap your input, and textImeMultiLine will provide a break-line key in your keyboard.
<EditText
...
android:layout_height="wrap_content"
android:inputType="textImeMultiLine|textMultiLine"
... />
In my case I have multiline text, but it showed one line and a keyboard:
Though I have already set android:inputType="textCapSentences|textAutoCorrect|textMultiLine", it didn't help. Then I understood that when the keyboard appears in DialogFragment, it collapses the EditText. See DialogFragment and force to show keyboard to show keyboard when DialogFragment shows.
Then I added a short delay (100-300 ms) before showing the keyboard. Now I have:
In AndroidManifest I set android:windowSoftInputMode="adjustResize" for current activity.

how to use 2 different ime option of soft keyboard

i want to show both because i have 3 edit text and in 2 second edit text i want to show both option on soft keyboard so that user can go to previous or next edit text, is there anyway to do this? here is my code can
<EditText
android:id="#+id/etxtrunner"
android:layout_width="180dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/txtrunner"
android:layout_alignBottom="#+id/txtrunner"
android:layout_alignRight="#+id/qrcode_img"
android:background="#color/gray"
android:singleLine="true"
android:imeOptions="actionNext"
android:ems="10" />
This question is a duplicate, yet, you can see that you can not have both next/previous button together in this answer.
However, you can make a makeshift solution like this.

Keyboard with search icon

I have a SearchActivty in my application on which I have an EditText and a Button to search the items. I want the search icon to be displayed in keyboard for this EditText.
Right now I've imeOption = "actionSearch" inside my EditText layout which is right now giving "search" as text in the keyboard. I want instead of text there should be an icon. IS it possible to set search icon on place of text in keyboard. If yes then please help.
My EditText in layout is :
<EditText
android:id="#+id/txtUser"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="type name here"
android:inputType="text"
android:singleLine="true"
android:imeOptions="actionSearch"/>
No, its not possible. The keyboard itself decides what should be shown where. Some keyboards will implement images for various imeOptions, some won't. But there's no way to force it.

Categories

Resources