android-edittext

Paste without rich text formatting into EditText

蓝咒 提交于 2019-12-18 04:36:18
问题 If I copy/paste text from Chrome for Android into my EditText view it gets messed up, apparently due to rich text formatting. Is there a way to tell the EditText view to ignore rich text formatting? Or can I catch the paste event and remove it before it gets set? How would I do that? UPDATE: So I realized that the editText.getText() gives me a SpannableString that contains some formatting. I can get rid of that by calling .clearSpans(); on it. BUT I cannot do anything like that in editText

EditText - change background color of text (and only text - not the whole view)

那年仲夏 提交于 2019-12-18 04:26:15
问题 When a user enters information in an EditText, and moves to the next EditText, the information is highlighted as shown below: The code for this: edittext.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { v.setBackgroundColor(Color.WHITE); ((EditText) v).setTextColor(Color.BLACK); } else { //v.setBackgroundColor(Color.LTGRAY); //also works like this ((EditText) v).setBackgroundColor(Color.LTGRAY); ((EditText)

How to make android EditText smaller than default in height?

99封情书 提交于 2019-12-18 03:54:29
问题 How to make android EditText smaller than default in height? If I change the height, I can't see my text, but it has extra blank on bottom. 回答1: EditText has a default padding set. Try this, <EditText android:text="Any Text" android:layout_width="fill_parent" android:layout_height="16dp" android:padding="2dp" android:background="#FFF" android:textSize="10dp" /> 回答2: Use android:textAppearance="?android:attr/textAppearanceSmallInverse" For further reference, see this : http://developer.android

How to make android EditText smaller than default in height?

大憨熊 提交于 2019-12-18 03:54:23
问题 How to make android EditText smaller than default in height? If I change the height, I can't see my text, but it has extra blank on bottom. 回答1: EditText has a default padding set. Try this, <EditText android:text="Any Text" android:layout_width="fill_parent" android:layout_height="16dp" android:padding="2dp" android:background="#FFF" android:textSize="10dp" /> 回答2: Use android:textAppearance="?android:attr/textAppearanceSmallInverse" For further reference, see this : http://developer.android

Android Edittext Rich Text Formatting

ぐ巨炮叔叔 提交于 2019-12-18 03:00:20
问题 Is there any library or open source application demo that contains Rich Text Format Edittext component with WYSIWYG interface. I've heard that android-richtexteditor contained such functionality, but it's source code is no longer available. If anyone have a link or source to the above please share it with me. 回答1: Here are two awesome libraries which helped me out. Both of them are implementation of WYSIWYG. Android RTEditor: https://github.com/1gravity/Android-RTEditor RichEditor-Android:

Android: Edittext with gravity center not working on device

回眸只為那壹抹淺笑 提交于 2019-12-18 02:37:16
问题 In Android I'm using a single line edittext with gravity set to center. In the Emulator this works great both the hint and a blinking cursor shows up. When testing on device (Xperia X10) neither the hint text nor the blinking cursor shows up. The blinking cursor only shows if I enter some text into the edittext. This is my edittext, can anyone see if something is missing? <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android

EditText cursor is invisible in Android 4.0

痞子三分冷 提交于 2019-12-17 23:25:06
问题 I have an EditText input in Android 4.0 and the Cursor is not showing inside it. What can make the cursor not appear in the input field? 回答1: Make android:cursorVisible="true" and If you have used android:textColor then set the android:textCursorDrawable attribute to @null . Happy coding ;) 回答2: I had a similar problem but it was because the cursor is actually white and I had a white background. I needed to be able to change the cursor to black in code somehow and used this approach. I

how to make hint disappear when edittext is touched?

时光毁灭记忆、已成空白 提交于 2019-12-17 22:44:25
问题 In my application in android are many EditText fields. And I ran into a problem with hint. It is not disappearing when EditText is focused, but it disappears when I start to write something. How can this problem be fixed? Because I need the hint to disappear when the EditText field is touched. It is for example: <EditText android:layout_width="260dp" android:layout_height="30dp" android:ems="10" android:inputType="text" android:id="@+id/driv_lic_num_reg" android:hint="@string/driver_license

Remove focus border of EditText

末鹿安然 提交于 2019-12-17 21:44:48
问题 How can I remove the border with appears when focusing an EditText View? I need it cause this view has little space in the screen, but without the border it's enough. When running on Emulator an orange border appears, on Device a blue one. 回答1: Have you tried setting the background of the EditText to a transparent colour? <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="@string/hello" android:background="#00000000" /> 回答2: <EditText android:id="@

How to hashtag value in different colour in EditText?

ε祈祈猫儿з 提交于 2019-12-17 20:55:14
问题 I am writing some text in EditText when i write "#data" its colour should be changed but doesn't change how can i do. Please check the below EditText which i have used <EditText android:id="@+id/et_simple" android:layout_height="wrap_content" android:layout_width="match_parent"> </EditText> 回答1: Hope this solution will help..! I used this solution it is very useful! like adding the textWatcher interface over your editText and listening to textChange and finding out if the word starts with a