android-edittext

Android EditText alternative

﹥>﹥吖頭↗ 提交于 2019-11-30 11:10:16
Currently, Android's EditText is extremely slow when dealing with a huge amount of lines of text (10000+). It appears like this slowdown is partially due to the fact that EditText supports spans, and primarily due to the fact that EditText is calculating the width of each line, which is very expensive. Are there any faster alternatives to EditText, or a way to optimize it to make it usable? EDIT: Method traces are as follows: android.text.StaticLayout.generate: 99.1% CPU time inclusive, 8.8% exclusive (1 call) android.text.Layout.getParagraphSpans: 28% inclusive, 1.1% exclusive (4686 calls)

editText is not losing focus

只谈情不闲聊 提交于 2019-11-30 11:09:21
the editText is not losing focus in my app when I click out of it, it has the orange border all time and that black line cursor.. I did this a LinearLayout according to this surrounding the editText: Stop EditText from gaining focus at Activity startup so it doesn't get focus on start of the app.. this is my code: final EditText et = (EditText)findViewById(R.id.EditText01); final InputMethodManager imm = (InputMethodManager) getSystemService( INPUT_METHOD_SERVICE); et.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { imm.showSoftInput(et, InputMethodManager.SHOW

How to right-align text in an Android TextView or EditText?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 10:41:07
I have an EditText in my application. I want to align the text in it to the right instead of the default left. I tried adding android:layout_gravity="right" but this doesn't seem to work. any other suggestions please? You should use android:gravity="right" . layout_gravity is for the view (EditText) alignment against the container. Erick You may use android:layout_alignParentRight="true" to align the EditText's right edge to its parent's right edge. Also, if you really want to use the layout_gravity or gravity attributes, check out this article that discusses the proper use of them. You can

Android Ice Cream Sandwich Edittext: Disabling Spell Check and Word Wrap

二次信任 提交于 2019-11-30 10:28:24
问题 Whilst testing on the Android Emulator running Android 4.0 (Ice Cream Sandwich), I have noticed that the Edittext does some quite strange things. Firstly, it underlines every word identified as "misspelt" in red. How do I disable this? Secondly, although in the layout XML I have specified android:scrollHorizontally="true" word-wrap is enabled: how do I disable this as well? Here is the Layout XML code for the Edittext: <EditText android:id="@+id/editor" android:layout_width="40dp" android

Highlight Textview Using EditText

╄→гoц情女王★ 提交于 2019-11-30 10:14:30
Im currently making a search engine like application for android and i want to highlight the searched word from edittext to textview... this is that i got so far and it only highlights the first word in the textview TV.setText("Hello World", TextView.BufferType.SPANNABLE); Spannable WordtoSpan = (Spannable) TV.getText(); WordtoSpan.setSpan(new BackgroundColorSpan(0xFFFFFF00), 0, notes.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); TV.setText(WordtoSpan); I think you want to highlight a specific word of TextView which user types in a EditText. Say et is your EditText and tv is TextView object.

Can't manage to requestFocus a Spinner

本秂侑毒 提交于 2019-11-30 09:04:31
I've got an annoying issue with a screen. The screen consists of a bunch of Spinners one under the other, and then underneath the spinner, an EditText. The problem is that when the screen starts, the EditText has focus, meaning that some Spinners are off the top of the screen. Try as I might, I cannot make the top Spinner start focused, either by using <requestFocus/> in the screen XML, or by using requestFocus() in code. I've attempted to do what requestFocus skipping next EditText suggests, and if I'm following the suggestion correctly, it doesn't work either. To reproduce the issue, create

How to add EditText in listview and get its value dynamically in all the rows?

人走茶凉 提交于 2019-11-30 08:58:50
I have Checkbox and EditText and a Textview in a listView. It gets value for the text view from a list. Checkbox will be checked dynamically. In the same way EditText also can be entered dynamically. Now my problem is, When i scroll the list view (up and down) after entering the text in the Edit text, I could not get the typed value. I check the check box also like that. But using the position, I set it correct. I Could not know How to set the EditText value to the list properly. Please help me. Here is my code: main.xml: (Main xml for launch) <?xml version="1.0" encoding="utf-8"?>

Android: Hiding the keyboard in an overridden “Done” keypress of EditText

家住魔仙堡 提交于 2019-11-30 08:47:49
I have used a bit of Android code to override the "Done" button in my EditText field: myEditField.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { mySubroutine(); return true; } return false; } }); Activating the field calls up the keyboard, and pressing "Done" evaluates mySubroutine() successfully. However, the keyboard no longer goes away when I press "Done". How do I restore this default behaviour to the routine? just_another_coder Why not:

Android: Evaluate EditText after the user finishes editing

放肆的年华 提交于 2019-11-30 08:47:01
问题 What I want I have an EditText, where the user can enter a value, such as 10.40. Once the user is done editing I am formatting his input to a currency, for instance the above mentioned value would get formatted to $10.40 (in the case of Locale.US). And I display that result in the same EditText that the user previously edited. Problem Because I am going to format (i.e. modify) his input, I need to know when he's done (so my formatting does not interfer with his ongoing input). What I tried

Setting up EditText with “url” inputType

无人久伴 提交于 2019-11-30 08:27:06
I am trying to make an EditText such that when i click it a key board containing ".com" appears because a url is to be intered into the EditText . I tried to use this: android:inputType="textUri" but it is not working. How do i do it? try this one <EditText android:id="@+id/edt" android:layout_height="wrap_content" android:layout_width="wrap_content" android:inputType="textWebEmailAddress" /> android:inputType="textWebEmailAddress" use this property for that. You can use inputType as textWebEmailAddress or textEmailAddress . Specs say it is device dependent but honestly I did not find any