android-edittext

Android EditText default numeric keyboard and allow text [duplicate]

◇◆丶佛笑我妖孽 提交于 2019-12-04 04:58:59
This question already has answers here : Closed 6 years ago . Possible Duplicate: EditText with number keypad by default, but allowing alphabetic characters Wondering if it is possible to default to a numeric keyboard on focus for an edittext field but also allow users to input characters? None of the input types seem to support this. Thanks! I just tried to add a number text field in Android and it ran in the emulator fine. It defaults to bring up the number pad first, but you can switch to characters just as easy. So try to use a number text field. <EditText android:id="@+id/editText1"

android: the first digit in the edit text can not be zero

不羁岁月 提交于 2019-12-04 04:47:42
I have an EditText element with a number input type. I don't want users to be able to enter 0 as the first digit. Can I enforce this using XML? Here is what I have currently: <EditText android:id="@+id/main_edt_loan" android:layout_width="fill_parent" android:layout_height="40dip" android:background="@drawable/sample_editbox" android:ems="10" android:layout_margin="10dip" android:inputType="number" android:hint="" android:ellipsize="start" android:maxLines="1" android:imeOptions="actionNext" android:textSize="18dip" android:gravity="center" android:digits="0123456789" android:maxLength="10"

How to hide keyboard on enter key

时光怂恿深爱的人放手 提交于 2019-12-04 04:35:31
i have an activity with four edittext and i want to hide keyboard when users finish to use one of the four edittext. if i click enter on keyboard, it will focus another edittext and keyboard still remain, but i need to hide keyboard, so to use only one edittext and not necessarily the other. This is xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/sfondo"> <LinearLayout android:id="@+id

Android RecyclerView Edittext issue

一世执手 提交于 2019-12-04 04:27:50
I'm creating a list of editable items (received from backend). I'm using the "new" recyclerview for this. There a couple of possible viewTypes in my recyclerview: checkbox spinner edittext The problem I'm having is with the EditText gaining focus. AdjustResize kicks in fine and my keyboard is shown. But the EditText that has gained focus isn't visible anymore in the list. (position in the list in the now resized portion is below the visible positions). I don't want to be using AdjustPan in this case because on top there is a pager & stuff I would like to keep fixed there.. This is happening

Android Custom EditText not showing cursor in ICS

白昼怎懂夜的黑 提交于 2019-12-04 04:26:33
I have an EditText in my application which is to only receive inputs from buttons I have placed on the screen. To avoid the soft keyboard appearing I have a customised EditText class as follows: public class CustomEditText extends EditText { public CustomEditText(Context context) { super(context); } public CustomEditText(Context context, AttributeSet attrs) { super(context, attrs); } @Override // Disables Keyboard; public boolean onCheckIsTextEditor() { return false; } } This successfully stops the keyboard from appearing, however in ICS this approach also stops the Cursor from appearing.

How to clear the selection in an EditText?

守給你的承諾、 提交于 2019-12-04 04:10:46
How do you programmatically remove the selection from an EditText ? I've tried: myEditText.setSelection(selectionEnd); but that just creates a selection of 0 length at the end of the current selection. I've also tried Selection.removeSelection(mySpannable) , and it just puts an empty selection at the beginning of the text. Calling myEditText.clearFocus(); . I think that's what you need To move selection to top: edit_text.setSelection(0); To move selection to bottom: edit_text.setSelection(edit_text.getText().length()); EditText message = (EditText) findViewById(R.id.sendText); String text =

Android EditText: How to create an empty bullet paragraph by BulletSpan?

吃可爱长大的小学妹 提交于 2019-12-04 04:04:14
I use the same title with this question , because I think my question is very similar to that one, I read and tested the accepted answer very carefully, however the accepted answer doesn't work for me. Let me describe my question: My code looks like: EditText myEdit = (EditText) this.findViewById(R.id.myedit); myEdit.setText("a\nb\n"); Spannable s = myEdit.getText(); s.setSpan(new BulletSpan(30), 0, 1, Spannable.SPAN_INCLUSIVE_EXCLUSIVE); s.setSpan(new BulletSpan(30), 2, 3, Spannable.SPAN_INCLUSIVE_EXCLUSIVE); s.setSpan(new BulletSpan(30), 4, 4, Spannable.SPAN_INCLUSIVE_EXCLUSIVE); myEdit

Android EditText's container (RecyclerView) auto scroll when EditText is Focused

江枫思渺然 提交于 2019-12-04 04:02:15
问题 I got a RecyclerView whose element contains a EditText widget. 1.currently focusing on the second EditText,the first EditText is partly showed on the screen. the first EditText is partly showed 2.when click the first EditText, it got focus, then RecyclerView would automatically scroll down to fully show the first EditText. RecyclerView automatically scroll down when first EditText got focused This is great,but what I want is RecyclerView should not automatically scroll. Any solution? thanks!

Edittext Fonts Are Not Displaying

谁都会走 提交于 2019-12-04 03:49:15
问题 I'm going through a weird problem. I have created CustomEdittext class for setting Typeface for whole application and it works successfully in nearly all cases. I am using circo.ttf The problem is that when I set android:inputType="textPassword" , text stops displaying after typing, maybe because the font doesn't have a password symbol or maybe there is some other problem. Below is an example of my issue : CustomEdittext.java public class CustomEdittext extends EditText { public

How to set color of UnderlineSpan?

与世无争的帅哥 提交于 2019-12-04 03:44:29
This question is a follow up to my last question: How to highlight text like Android spell-checker? I'm using an UnderlineSpan to underline text in an EditText but I need the underline to be IN COLOR like this screen shot of the spelling checker: Lisa Wray Unfortunately, you can't do this solely with a Span -- there are no public methods to do what you ask. There is a method to set the underline color in TextPaint independent of the text color (you can see it in the source code for SuggestionSpan) but it's hidden . If you can get access to the EditText, you can handle the Span and draw the