android-edittext

How to implement Multiline EditText with ActionDone button (without Enter button)

荒凉一梦 提交于 2019-11-30 04:51:07
I have EditText which is used for entering contents on messages (emails, sms). I want message to be immediately posted on ActionDone button click. I use following code for this: message.setOnEditorActionListener((textView, i, keyEvent) -> { switch (i) { case EditorInfo.IME_ACTION_DONE: if (messageCanBePosted()) { SoftKeyboard.hide(message); postMessage(); return true; } else { return false; } default: return false; } }); But also I want this message field to be multiline, like in any other messenger apps. I can achieve it with this line: android:inputType="textMultiLine" The problem is that

Remove show password icon in Android N

荒凉一梦 提交于 2019-11-30 04:27:20
New Android version automatically draws show password icon when I set android:inputType="textPassword" in EditText view. How can I disable it? Thanks Cremons The password icon (or eye-icon) use be removed with the method setPasswordVisibilityToggleEnabled or with app:passwordToggleEnabled through XML. For more information see support library revisions . Example: <android.support.design.widget.TextInputLayout android:id="@+id/new_password_layout" android:layout_width="match_parent" android:layout_height="wrap_content" app:errorEnabled="true" app:passwordToggleEnabled="false"> <EditText android

How to remove the underline from the EditText field in Android?

。_饼干妹妹 提交于 2019-11-30 04:16:34
Whenever a word is typed in the EditText box, I always see an underline under the word being typed. But when I press a space after that word I no longer see the underline. My reqirement is to remove that underline when the user is typing the message. Added is the screenshot and we see that Smith is underlined. But I don't want this to happen. Below is the xml that I use for the AlertDialog box. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android

Show keyboard for edittext when fragment starts

血红的双手。 提交于 2019-11-30 04:11:24
When my fragment starts, I want my edittext to be in focus/let user to just start typing in it. I am able to get it in focus with requestFocus(), but I cannot get the keyboard to show up. I have tried both this: edit = (EditText) view.findViewById(R.id.search); edit.requestFocus(); InputMethodManager imgr = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imgr.showSoftInput(edit, 0); and edit = (EditText) view.findViewById(R.id.search); InputMethodManager imgr = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imgr

Label in a editbox in android

一个人想着一个人 提交于 2019-11-30 04:05:23
My question is, how to put a label in a editBox in android ? Like for example, i want to put "To:" in editbox of a contact picker which will not get deleted even if I press backspace on the onscreen keyboard. I tried with android:hint , but it gets deleted when the editBox is focus or clicked. I tried with image but it's not looking good. So, I need a method by which i can implement this label thing. See the visual diagram I give you two ideas to do this : If you only need this in a couple of places, you can use a FrameLayout / merge to have a TextView over your EditText. Then using a padding

Android text input layout

柔情痞子 提交于 2019-11-30 04:03:29
问题 I have a text input layout and I want to use that to show an error message if the data entered in an edit text inside it is incorrect. The definitions are as follows: <android.support.design.widget.TextInputLayout android:id="@+id/number_input_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/TextLabelWhite" > <EditText android:id="@+id/number_edit_text" android:layout_width="match_parent" android:layout_height="wrap_content" android:digits

How to unbold the selected text in Edittext Android?

断了今生、忘了曾经 提交于 2019-11-30 03:58:15
问题 I am working with an edit text to support the properties of bold,italic and underline.I got succeed after selecting the text and make it bold. Now I want to remove the bold after clicking on Normal button. Typeface.NORMAL is not working at here. Can any one suggest other option. Button btnBold = (Button) findViewById(R.id.btnBold); btnBold.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startSelection = etx.getSelectionStart(); endSelection = etx

android EditText ,keyboard textWatcher problem

偶尔善良 提交于 2019-11-30 03:42:28
I am working on a android app and I have an EditText where user can input numbers. I want to format the number using different currency formats (say ##,##,###) and I want to do it on the fly, ie when user enter each digit(not when enter is pressed). I googled around, and came across TextWatcher which I first found promising, but it turned out to be an absolute pain. I am debugging my code on a HTC Desire phone which only has a soft keyboard. Now I want to get a callback when user press numbers (0 to 9) , del (backspace) key and enter key. From my testing I found these (atleast on my phone) 1)

Avoid that EditText consumes click event

你。 提交于 2019-11-30 03:41:22
问题 Normally it's enough to set focusable , focusableInTouch + clickable to false. But here it does not work. I want the parent LinearLayout to consume clicks on the EditText as well but it does not work... <LinearLayout android:id="@+id/llText" android:layout_width="0dp" android:layout_weight="1" android:background="?attr/selectableItemBackground" android:layout_height="match_parent" android:orientation="horizontal"> <TextView android:id="@+id/tvText" android:layout_width="0dp" android:layout

In Android, how to make Login button disable with respect to EditText?

 ̄綄美尐妖づ 提交于 2019-11-30 02:27:57
If EditText is empty then Login Button has to be disabled. And if EditText has some texts then Login Button has to be enabled. Well you can see this method on Instagram Login. Both fields are empty, Sign in Button is DISABLED. Here Password field is empty, so still Sign in Button is DISABLED. Here both Username and Password field is not empty, So Sign in Button is ENABLED. how to achieve these steps?? here is my code and it doesn't work.. EditText et1,et2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login