android-edittext

How to make edittext scrolling smoothly

旧巷老猫 提交于 2019-12-08 14:24:10
问题 I'm gonna make a texteditor, but there's a problem, it can not scroll smoothly especially when theres big text in it. I have overridedden the oninterceptTouchEvent and ignored some actions, but it doesn't work 回答1: Did you tried this? editText.setVerticalScrollBarEnabled(true); editText.setMovementMethod(new ScrollingMovementMethod()); (assuming your EditText's editText) 来源: https://stackoverflow.com/questions/29304118/how-to-make-edittext-scrolling-smoothly

Android EditText setText and input text in last?

℡╲_俬逩灬. 提交于 2019-12-08 14:09:12
问题 I use EditText to input some information, and I setText in EditText. But I have a problem, when EditText display, the keyboard display too. when I input text it will add text in first not after text that I set before! this is my editText with keyboard [here is keyboard input text]example <- this example is my setText I need to set up input text after my text like this example[here is keyboard input text] Thanks for help .... 回答1: I think you need setSelection to move to end of your text

onButtonClick is never used in source code?

北城以北 提交于 2019-12-08 12:23:52
问题 I am writing a simple app which is working fine but the issue I have is that I am using a password condition to trigger a button click if entered correctly. The issue is that my source code is saying 'onButtonClick' is never used and when I manually press that button in the app, it suddenly force closes and crashes. Anyone know what I am doing wrong. I am extending Activity , at the start of the source code. Should I be extending AppCompatActivity ? public class Gvoice extends Activity

Android EditText bottom line color and theme changes

只愿长相守 提交于 2019-12-08 12:18:57
问题 hello all i need to remove the edittext default style i want to remove the selected portion from both the side on focus of edittext or on normal edittext i just want the simple black line on normal edittext and blue line on focus I have created 1 xml: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true"><shape android:shape="line"> <!-- Draw a 2dp width border around shape --> <stroke android:width="1dp

How to make an EditText scrollable inside a scrollable LinearLayout?

回眸只為那壹抹淺笑 提交于 2019-12-08 11:14:42
问题 The LinearLayout scrolls but the EditText doesn't. <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="top" android:orientation="vertical" > <EditText android:id="@+id/messageeditor_editText2" android

how to regain focus on a edit text when expandable list is reloaded…?

天大地大妈咪最大 提交于 2019-12-08 10:44:42
问题 I have a ExpandableListView in which i am loading custom layouts in both group and child views. They are having some edit text fields. When i click on the edit text, the soft keyboard appears, that time the list is reloaded, but focus will not be on the edit text. As a result the input i am typing is not entered in that edit text. If i clicked on the edit text again i can enter the values. But I want to regain its focus even after reloading the list view. I tried with storing the last clicked

I want to add dynamic layout with text view and edit text on button click for N level

巧了我就是萌 提交于 2019-12-08 10:21:46
问题 When click on add phone text I want to add view dynamically (view below add phone: where 'mobile' is textview and on right side there is edit text) and this need to be for N level ..when user click on add phone view will be added.. How to do this.? 回答1: Try this code.This might help you. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation=

How to force EditText to accept only specific alphanumerical characters?

倖福魔咒の 提交于 2019-12-08 10:12:17
问题 I want from my EditText to accept only certain characters. I don`t want to filter them in listener, I want to set it in XML permanently. I want to use only these characters: 0123456789abcdefghijklmnopqrstuvwyzABCDEFGHIJKLMNOPQRSTUVWYZ So I made string and add that to android:digits . I want to convert each lowercase letter to uppercase (I dont want to disable typing without shift just convert them) I used android:textAllCaps="true" but this doesnt work. 回答1: Try this, This will help you for

Android: EditText listener for cursor position change [duplicate]

◇◆丶佛笑我妖孽 提交于 2019-12-08 09:54:20
问题 This question already has answers here : Android EditText listener for cursor position change (8 answers) Closed 4 years ago . I'm looking for a way to detect a cursor position changed in an EditText. I couldn't find anything in the documentation so far. Has anyone solved this already? 回答1: You can override onSelectionChanged (int selStart, int selEnd) to get notified about selection changes. If the cursor is moved, this is called as well (in this case selStart == selEnd) 来源: https:/

measure length of edittext string dynamically in android

佐手、 提交于 2019-12-08 09:07:13
问题 How can i measure length of string entered in the edittext while typing.Because i want to show a warning when the entered text length cross 100 character. Thanks in advance. 回答1: You can use TextWatcher to your EditText to do that in Android. Something like this EditText test = new EditText(this); test.addTextChangedListener(new TextWatcher() { public void beforeTextChanged(CharSequence s, int start, int count, int after) { } public void onTextChanged(CharSequence s, int start, int before,