Keyboard with search icon - android

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.

Related

Hint or Text value is not getting removed from edittext when user is typing in edittext

I am having a edittext in my layout i have tried putting hint or text in my edittext.
When i touch or click edittext for first time the mobile keypad popups to type text, which is expected but the text or hint inside edittext is not getting removed. i have to tap 2 times the edittext then first time the mobile keyboard popups and second tap removes the text.
i want on first tap itself the text should get removed from edittext.
for example : Suppose if EditText is having initial text as User Name, now when user click on edittext first time the User Name should get disappear so the user can type his name there.
below is my edittext code.
<EditText
android:id="#+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/textView2"
android:layout_marginTop="30dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:gravity="start|top"
android:hint="Enter Name..."
android:textColor="#8c8c8c"
android:inputType="textMultiLine" />
Please help on above i have tried onClickListener also so that when we tap edittext it will make text empty but that also not working. i have to tap 2 times to remove text. i want the text should get disappear on first touch.
Please check below points -
Check if you have set any text to EditText dynamically? If yes, you can remove it and set the text as hint. As you said, if EditText is having initial text as User Name... if you want to show text as hint or you need it to show only for the first time. Then, you set the required text User Name as hint NOT AS TEXT to editText.
You can use editText.setHint("UserName") to set hint dynamically or android:hint="UserName" to set hint in xml.
If this is not the case, then you need to post the code snippets to find the exact error.

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.

Numeric Keyboard on close opens Alphanumeric keyboard

I am using inputType:number for EditText.
But the problem is that when I click on Done Button(Right Mark) present at bottom left of keyboard it opens up Alphanumeric keyboard.
My EDIT TEXT XML Code:
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/enter_detail"
android:hint="Enter Detail"
android:padding="20dp"
android:inputType="number"
android:textColorHint="#42a5f5"
android:textColor="#color/title_black"
app:layout_constraintTop_toBottomOf="#id/radio_group"/>
UPDATE
I have found that DATEPICKER with datePickerMode="spinner" is creating issue.
I switched to datePickerMode="calendar" and it solved the problem.
I think there is a problem with the DatePicker widget because when used spinner mode bottom part is incomplete(Please refer to this question to understand this problem: Android: Datepicker bottom part not visbile)
I have created GIF of the video:
How about replacing the inputType with "number|numberDecimal"
android:inputType="number|numberDecimal".

Android Keyboard style with OK Button

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"/>

EditText isn't highlighted when touched

I assumed this feature would be activated by default.
How do I set an EditText box to do the normal orange highlighting when a user touches it?
By default it is highlighted only when user clicks on it. You don't have to write anything for that.
<EditText
android:layout_below="#+id/Button04" android:id="#+id/EditText01"
android:layout_height="wrap_content" android:text="#+id/EditText01"
android:layout_width="wrap_content"></EditText>

Categories

Resources