android-edittext

Rounded Background text like Instagram, ReplacementSpan not working as required

北战南征 提交于 2019-12-17 16:12:20
问题 I was trying to do something similar to Instagram below - But i want this curves like Instagram - Now i am stuck in one more problem - When i types,. text does not goes automatically to next line, I have to press return , like normally editText works in fixed width. (In short multiline is not working fine with ReplacementSpan ) Below is sample code for what i have done - public class EditextActivity extends AppCompatActivity { EditText edittext; RoundedBackgroundSpan roundedBackgroundSpan;

EditText On A Popup Window

∥☆過路亽.° 提交于 2019-12-17 16:07:02
问题 I am developing on Android 2.2 using Java. I put an editText on a PopupWindow and it's not working. It acts like a disabled edit text, clicking on the edit text won't show the soft keyboard. How can I add an edit text on a popupWindow? 回答1: Just try: AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("Title"); alert.setMessage("Message"); // Set an EditText view to get user input final EditText input = new EditText(this); alert.setView(input); alert.setPositiveButton(

KeyCode_Enter to next edittext

怎甘沉沦 提交于 2019-12-17 15:54:27
问题 In edittext, after typing 'Enter' key, system make a new line inside it. I'd like to focus on next edittext, no new line. how to code? my code in xml is below <EditText android:id="@+id/txtNPCode" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="18sp" android:layout_alignLeft="@+id/lblNPCode" android:layout_below="@+id/lblNPCode" android:layout_centerHorizontal="true"/> <EditText android:id="@+id/txtCNPCode" android:layout_width="fill_parent" android

In Android, how to create EditText of fixed width?

假如想象 提交于 2019-12-17 15:29:41
问题 I would like to create an EditText which accepts only numbers, has a maximum of 4 numbers, and is never narrower than it would be if filled with 4 numbers (does not shrink when empty, or have to expand to accommodate 4 numbers, so it's fixed.) The first 2 are accomplished with: android:inputType="number" and android:maxLength="4". How can I set the minimum length? 回答1: A little hackish , but you can put your EditText inside a FrameLayout alongside with another TextView with text="0000" and

How do I return an int from EditText? (Android)

落爺英雄遲暮 提交于 2019-12-17 15:27:08
问题 Basically, I want an EditText in Android where I can have an integer value entered into. Perhaps there is a more appropriate object than EditText for this? 回答1: For now, use an EditText . Use android:inputType="number" to force it to be numeric. Convert the resulting string into an integer (e.g., Integer.parseInt(myEditText.getText().toString()) ). In the future, you might consider a NumberPicker widget, once that becomes available (slated to be in Honeycomb). 回答2: Set the digits attribute to

How to place button inside of edit text

前提是你 提交于 2019-12-17 15:16:24
问题 I want to place an image button inside of EditText, but I don't have Idea please tell me how to do so as shown in the figure . Thanks 回答1: If You dont want click on that Image, Then you can use drawableRight property for EditText.. android:drawableRight="@drawable/icon" If you want click then use below code. <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content"

how to hide keyboard after typing in EditText in android?

橙三吉。 提交于 2019-12-17 15:13:16
问题 I have a EditText and button aligned to parent's bottom. When I enter text in it and press the button to save data, the virtual keyboard does not disappear. Can any one guide me how to hide the keyboard? 回答1: This should work. InputMethodManager inputManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(),InputMethodManager.HIDE_NOT_ALWAYS); Just make sure that this.getCurrentFocus()

Android: Vertical alignment for multi line EditText (Text area)

和自甴很熟 提交于 2019-12-17 15:08:48
问题 I want to have 5 lines for the height of the text area. I am using the following code. <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:singleLine="false" android:lines="5" android:layout_marginLeft="10dip" android:layout_marginRight="10dip" /> The text area looks fine, but the problem is that the cursor is blinking in the middle of the text field. I want it to blink at first line, at the first character of the text field. 回答1:

How to use regular expression in Android

匆匆过客 提交于 2019-12-17 13:44:56
问题 I have a numberDecimal EditText which I want to validate using a regular expression. In validation what I want is: Before the decimal point, the maximum digit I want to enter is three and the digit should not start with zero like 2,23,342 , etc. After the decimal point, the maximum digit I want to enter is one like .1 , .3 , .6 , etc. So the number that I allow the user to enter is like 2.1 , 32.5 , 444.8 , 564.9 , etc. But in my code, what happens is: It allows the user to enter more than a

Soft Keyboard Overlapping with EditText Field

丶灬走出姿态 提交于 2019-12-17 11:53:21
问题 I found this old post which definitely helps with my problem, but I'm noticing that it doesn't really seem to solve my problem. I have gathered that I need to set android:windowSoftInputMode="adjustPan" for my activity. But the issue is that it simply doesn't pan ENOUGH. The text field is toward the bottom of the view, and when the keyboard shows up, the view shifts slightly but only the very top of the EditText. The text field has autocomplete turned on, and when it begins to show