android-edittext

Android-Change Edittext after each change

末鹿安然 提交于 2019-12-10 22:09:49
问题 how can i add Char such as this dash '-' after each change in edtitext for example if the user enter A then the text in edittext will be A- then the user will complete and enter Char B then the edittext will be A-B How to implement this ? thanks name = (EditText)findViewById(R.id.editText1); name.addTextChangedListener(new TextWatcher(){ public void afterTextChanged(Editable s) { name.setText("-"); } public void beforeTextChanged(CharSequence s, int start, int count, int after){} public void

RTL support to custom editext for drawable left

限于喜欢 提交于 2019-12-10 21:42:25
问题 I have an edittext having an image as drawable left with a non-editable prefixed editext but now i wanted to make it to support rtl. Despite my effort I am not able to support rtl. My Custom class is as follows, public class PrefixedEditText extends TextInputEditText { private String mPrefix = "+"; // can be hardcoded for demo purposes private Rect mPrefixRect = new Rect(); // actual prefix size public PrefixedEditText(Context context, AttributeSet attrs) { super(context, attrs); } @Override

Set limitation for EditText height and maximum lines according to the screen size

半城伤御伤魂 提交于 2019-12-10 21:05:35
问题 I have a notebook application and I want to limit my editText maximum lines according to the screen height. for example 40 lines in nexus-6p and 35 lines in nexus5 and etc. So my question is how can I limit the editText lines? I don't have any idea for this. UPDATE I want to create new note page when cursor reached the last line. 回答1: I Found the solution, thank everyone for the response. My solution is: int lineHeight = getLineHeight(); int height = getHeight(); int maximumLines = height /

Android: Expand the inputType of EditText?

混江龙づ霸主 提交于 2019-12-10 20:47:52
问题 I'd like to allow possible inputs of 0-9, "," or "-" for EditText and couldn't find an answer. I know using the "|" as an separator is possible: android:inputType="number|text" But how can I archive something like this (too bad it doesn't work): android:inputType="number|,|-" Does anyone know? Regards, cody Addition to the comment below: private class MyKeylistener extends NumberKeyListener { public int getInputType() { return InputType.TYPE_CLASS_NUMBER; } @Override protected char[]

EditText.setError doesnt show Error text and only shows icon

二次信任 提交于 2019-12-10 20:24:10
问题 I have a simple validation in my app, here I am using four EdtiText .I am showing error when EditTex t loses focus but, the problem is on losing focus EditText only shows icon without error message. I have tried using requestFocus() method and can now see the error but the problem is.. now my form shows two cursors and even if the first field is not valid and showing errors, whatever I am typing goes into second EdtiText . Can anybody help me to fix this? Thanks. Here is my xml file -

Prevent background resize AND prevent auto-focus on activity start

*爱你&永不变心* 提交于 2019-12-10 19:55:49
问题 After looking up various questions on stack overflow, I have found that many other people had the following problems: Background gets resized when soft keyboard opens Soft keyboard opens when activity starts The solution to both of these lies in the ActivityManifest.xml . To prevent the background image from being resized when the soft keyboard opens, you can add android:windowSoftInputMode="stateVisible|adjustPan" to the <activity> in the manifest. To prevent the soft keyboard opening when

EditText remove black underline while typing

∥☆過路亽.° 提交于 2019-12-10 19:47:03
问题 I have bit of an issue in my EditText. I have a piece of code that detects when a specific piece of text is underlined (so that a underline icon can be highlighted). This is achieved by detecting UnderlineSpans. However when typing there are underlines under the current word, which appears to also use UnderlineSpans, therefore leading the underline icon being selected: https://i.stack.imgur.com/jBloM.jpg I've already tried adding android:inputType="textNoSuggestions" to my EditText XML.

moving edit text along with soft keyboard android

有些话、适合烂在心里 提交于 2019-12-10 17:49:48
问题 I am having an comment edit text in my application. The edit text is aligned at the bottom of the screen. when edit text is focused i want to move edit text alone with soft keyboard without changing other views in layout similar to comment edit box in facebook. I tried adjustpan in manifest but it moves all views up with soft keyboard. adjustresize in manifest hides some view.please provide suggestions. 回答1: Try like this inside your Android manifest file.. <activity name="YourActivity"

android edittext align text to right and label to left

隐身守侯 提交于 2019-12-10 17:45:31
问题 I want to have an edit text where a label "Name" is displayed on left side of the edit text and the input is enterd from Right to left If i set android:gravity as right , input is getting from right to left. But in this case the label ie whatever given as android:text for the edittext is also coming right aligned. If i used android:hint , and set android:gravity as right, the hint is not displayed at all. What is the option to get label on left and input on right. 回答1: I don't know everything

Android-7.0: EditText wrong actionId in editor actionlistener

限于喜欢 提交于 2019-12-10 17:36:36
问题 I have an edit text declared in xml like this with following properties and i have set android:imeOptions="actionNext" <EditText android:id="@+id/ui_row_create_poll_edit_text_txt_name" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginLeft="@dimen/margin_normal" android:layout_toLeftOf="@id/ui_row_create_task_user_info" android:background="@android:color/transparent" android:paddingBottom="@dimen/padding_large