android - imeOptions have search button say "Search" instead of magnifying glass - android

I was wondering if its possible to change magnifying glass on the Search button to text "Search". We want to preserve the imeOptions setting to android:imeOptions="actionSearch" because we respond to a certain event.
Here is what I have:
<EditText
android:id="#+id/txtSearch"
android:textSize="14px"
android:textColor="#color/main_text_black"
android:layout_width="189px"
android:layout_height="fill_parent"
android:imeOptions="actionSearch"
android:gravity="center_vertical"
android:singleLine="true"
android:background="#null"
android:layout_alignParentLeft="true"
android:layout_marginLeft="24px"/>
Tried this:
<EditText
android:id="#+id/txtSearch"
android:textSize="18dp"
android:textColor="#color/main_text_black"
android:layout_width="247dp"
android:layout_height="fill_parent"
android:imeOptions="actionSearch"
android:imeActionLabel="Search"
android:gravity="center_vertical"
android:singleLine="true"
android:background="#null"
android:layout_alignParentLeft="true"
android:layout_marginLeft="38dp"/>
This only works in landscape mode which our app does not support and the word Search shows up in the wrong place.

You can try it!
<EditText
android:id="#+id/edt_search_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:imeOptions="actionSearch"
android:inputType="text"/>

No, this is impossible unless you implement your own Keyboard for that EditText. The Text (or icons) on the keys of a keyboard is controlled by the person who wrote the keyboard.

Related

EditText flow, what determines the action button on virtual keyboard?

I have 2 same identical EditText:
<EditText
android:id="#+id/card_num_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="1"
android:digits="0123456789"
android:ems="13"
android:inputType="phone"
android:singleLine="true"
android:textSize="14sp"
/>
Other one:
<EditText
android:id="#+id/phoneRegEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="1"
android:digits="0123456789"
android:ems="13"
android:inputType="phone"
android:singleLine="true"
android:textSize="14sp" />
One of them have a "next one" action button when the virtual keyboard shows up, the other have an "ok" action button.
The "next one" is passing focus to the next EditText but the "ok" is doing nothing just hiding the virtual keyboard.
My question is, what conditions decide which button is showing up? In my opinion Android have a huge deficiency with EditText's focus flow.
It is done by IME_OPTIONs More info here
<EditText android:id="#+id/some_edittext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:imeOptions="actionDone"><!-- Here you set whatever option you want -->

Done button does not appear on Android soft keyboard

I am defining the EditText as below. I want the Done button to appear in the soft keyboard but I am getting Return button instead.
<EditText
android:id="#+id/txtCommentContent"
android:layout_width="match_parent"
android:layout_height="160dp"
android:layout_margin="5dp"
android:background="#drawable/bg_edittext_gradient"
android:gravity="top|start"
android:hint="#string/strHintContentComment"
android:maxLines ="4"
android:imeOptions="actionDone"
android:padding="5dp"
android:textSize="15sp"
android:textColor="#color/black"
android:scrollHorizontally="false"/>
Can anyone point out what I am doing wrong?
Did you try?
editText.setImeOptions(editText.getImeOptions()| EditorInfo.IME_ACTION_DONE);
With
android:inputType="text"
You need to add:
android:singleLine="true"
done button will show, but you can not use done button and return button(next line) same time on softkeyboard

Can't focus EditText

I have a simple EditText inside my scrollview.
All the other elements are working just fine, however i won't get the usual EditText behaviour on click (Keyboard doesn't appear, I can't write).
Here's my xml for the field.
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/enterWishprice"
android:background="#drawable/edit_back"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="0 F€"
android:gravity="center_vertical|center_horizontal"
android:textSize="26dp"
android:inputType="number"
android:layout_margin="10dp" />
As you can see I already tried setting focusable/inTouchMode.
I also tried setting a click listener on the field to manually open the keyboard which works just fine. However I still can't type anything into the field.
After that i tried using requestFocus in the clicklistener without any result.
Furthermore I tried clearFocus on the EditText as well as the surrounding ScrollView - also not working.
Hopefully you can give me a hint cause I'm out of ideas..
Thanks in advance!
The attribute Enabled must be set to true.
<EditText
android:id="#+id/room_message"
android:layout_width="164dp"
android:layout_height="46dp"
android:clickable="true"
android:ems="10"
android:enabled="true"
android:focusableInTouchMode="true"
android:hint="#string/prompt_message"
android:inputType="textPersonName"
android:textColor="#FFFFFF"
android:textSize="18sp"
android:textStyle="italic"
/>
But i have got another problem where the EditText won't lose focus....
try like this
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/enterWishprice"
android:background="#drawable/edit_back"
android:focusableInTouchMode="true"
android:text="0 F€"
android:gravity="center_vertical|center_horizontal"
android:textSize="26dp"
android:inputType="number"
android:layout_margin="10dp">
<requestFocus />
</EditText>

Strange error of dimensionally on the EditText after disabling the standard Android keyboard

in my app I have disabled the standard Android keyboard for each EditText with
myEditText.setInputType(0);
but now when I use the instruction:
myEditText.setText("string");
the sizes of my EditText does not fit to the size of the text you entered; so the text is not displaying in whole.
How can I fix this?
This is my xml:
<LinearLayout
android:layout_width="305dp"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="DECIMAL:"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="25sp"
android:textStyle="bold" android:textColor="#000000"/>
<EditText
android:id="#+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
>
</LinearLayout>
If you want to disable editText then I recommend to use editText.setEnabled(false). Hiding keyboard is not the right solution until you really need it. But if you have disabled edittext then keyboard will not appear even if you focus on it.
I don't think problem is because of keyboard. One thing I observed in your code is, you are setting ems for editText. I think because of ems, editText size is constant always. Check this link for more information.

Android EditText keyboard newline not working (only on input view)

In the affirmation text field I press the newline button and it puts spaces.
However after I click done the field actually has the correct new lines (second screen capture).
Its not a problem with the device as it works correctly for the compose mail filed in the gmail app. Which is how I would like this to work.
<TextView
android:inputType="textMultiLine"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:text="#string/edit_affimation"
/>
<EditText
android:id="#+id/affText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp"
android:singleLine="false"
>
</EditText>
Figured it out
<EditText
android:inputType="textMultiLine"
android:id="#+id/affText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp"
android:singleLine="false">
</EditText>
Add following attribute:
android:inputType="textMultiLine"
You can also do it programmatically:
Editext txt = (EditText) findViewById(R.id.affText);
txt.setRawInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE);

Categories

Resources