android-edittext

Displaying soft keyboard whenever AlertDialog.Builder object is opened

点点圈 提交于 2019-11-28 06:46:32
My code for opening an input dialog reads as follows: final AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("Dialog Title"); alert.setMessage("Request information"); LayoutInflater factory = LayoutInflater.from(this); final View textEntryView = factory.inflate(R.layout.edittextautotextlayout, null); final EditText inputBox = (EditText) textEntryView.findViewById(R.id.my_et_layout); alert.setView(inputBox); This works fine except that I have to tap the text entry line before the soft keyboard appears. Following the advice given here I have tried inserting: inputBox

Disable scroll option in EditText

你。 提交于 2019-11-28 06:41:02
问题 Disable scroll option in EditText when the user enter more characters on that. Instead of scroll option i need to reduce the font/type size. What i am currently doing is getting the count of characters and if it is exceeding a particular limit reducing the font size. What i want to do is when the scrolling option getting activated, need to reduce the size. qQuestionEditText.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before,

How can I detect focused EditText in android?

拥有回忆 提交于 2019-11-28 06:16:26
I have a number of EditText s in my page along with two buttons. I want the user to touch on any one EditText field and click any button to insert a certain value into that very EditText field he touched. Giving input using keypad is not allowed. Please help me to do this. One thing that you can do is declare a global variable evalue which will tell you which is the last selected EditText by using onTouchListener and then based on the value of evalue , you can set the text value to the edittext by button click. hope you understood. the code for it can be as follow: EditText e1,e2; Button b1,b2

Android Keyboard hides EditText

社会主义新天地 提交于 2019-11-28 06:14:23
When I try to write something in an EditText which is at the bottom of the screen, the soft keyboard hides the EditText. How can I resolve this issue? Below is my xml code. I'm using this in a Fragment. <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" > <LinearLayout android:id="@+id/linearLayoutTopDetails" android:layout_width="fill_parent" android:layout_height="wrap_content"

How can restrict my EditText input to some special character like backslash(/),tild(~) etc by soft keyboard in android programmatically

Deadly 提交于 2019-11-28 06:11:11
I am developing an application for keyboard, but i am geting an issue. I want to restrict/block some special character from soft keyboard in EditText in android programmatically. So, Is there any way i can restrict any special character input in edit text in android. If anyone have idea,Please reply. Thanks in advance. Try this may works for you public class MainActivity extends Activity { private EditText editText; private String blockCharacterSet = "~#^|$%&*!"; private InputFilter filter = new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end,

Android EditText Max Length [duplicate]

匆匆过客 提交于 2019-11-28 06:07:33
This question already has an answer here: Limit text length of EditText in Android 19 answers I set up a max length of text in an EditText field. <EditText android:id="@+id/courseDescriptionField" android:layout_width="fill_parent" android:layout_height="wrap_content" android:inputType="textMultiLine" android:lines="5" android:maxLength="@integer/max_course_description_limit" android:gravity="left|top" > </EditText> The problem for me however is, that, text STOPS appearing after 140 characters, but it still continues to type, except that text just doesn't appear, but however, it does appear in

Mask an EditText with Phone Number Format NaN like in PhoneNumberUtils

≯℡__Kan透↙ 提交于 2019-11-28 05:52:31
I want to make user inputted phone number in an editText to dynamically change format every time the user inputs a number. That is, when user inputs up to 4 digits, like 7144, the editText shows "714-4". I would like the editText to be dynamically updated to format ###-###-#### whenever the user inputs a digit. how can this be done? also, I am handling more than one editTexts. brockoli Easiest way to do this is to use the built in Android PhoneNumberFormattingTextWatcher . So basically you get your EditText in code and set your text watcher like this... EditText inputField = (EditText)

Multiple EditText objects in AlertDialog

我的梦境 提交于 2019-11-28 05:42:09
I'm working on a project for college that will let a user place a point on a map and then set the title and description for the overlay object. The problem is, the second EditText box overwrites the first one. Here is my code for the dialog box. //Make new Dialog AlertDialog.Builder dialog = new AlertDialog.Builder(mapView.getContext()); dialog.setTitle("Set Target Title & Description"); dialog.setMessage("Title: "); final EditText titleBox = new EditText(mapView.getContext()); dialog.setView(titleBox); dialog.setMessage("Description: "); final EditText descriptionBox = new EditText(mapView

Alternative of singleLine attribute (Deprecated) TextInputEditText

六月ゝ 毕业季﹏ 提交于 2019-11-28 05:41:29
I recently used TextInputEditText and I got lint error that singleLine attribute is Deprecated <android.support.design.widget.TextInputEditText android:id="@+id/my_edit_text" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/string_hint_dob" android:lines="5"/> </android.support.design.widget.TextInputLayout> Getting strike-through as below: Is there any alternative way for this? fractalwrench The android:singleLine attribute has been deprecated since API Level 3 . You can achieve the same behaviour by using android:maxLines , which allows you to

Is the xml attribute singleLine deprecated or not in Android?

泪湿孤枕 提交于 2019-11-28 05:11:17
singleLine is/was used in xml layout files for TextView and EditText something like the following: <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" /> Some people on SO say singleLine is deprecated, while other people still suggest using it. Sometimes it even seems necessary to use when maxLines="1" doesn't work. (see here , here , and here ) The docs should be the place to go to answer this question, right? Here, they say: This constant was deprecated in API level 3. This attribute is deprecated. Use maxLines instead to change the