Android click on the text in EditText, how to get the specific location of the current text in the input text?
Android click on the text in EditText, how to get the specific location of the current text in the input text?
use editText.setSelection (Edittext.length ())
Example
EditText editText = findViewById(R.id.editText);
editText.setSelection(editText.getText().length());
use this method to disable popping up of the system keyboard, call the custom keyboard, and return false, in the setOnTouchListener event of editext otherwise the cursor cannot be moved to the position where the finger is clicked.
private void showEditText (EditText edit) {
if (android.os.Build.VERSION.SDK_INT <= 10) {//4.0
edit.setInputType(InputType.TYPE_NULL);
} else {
this.act.getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
try {
Class<EditText> cls = EditText.class;
Method setShowSoftInputOnFocus;
setShowSoftInputOnFocus = cls.getMethod("setShowSoftInputOnFocus",
boolean.class);
setShowSoftInputOnFocus.setAccessible(true);
setShowSoftInputOnFocus.invoke(edit, false);
} catch (Exception e) {
e.printStackTrace();
}
}
}
Previous: Custom keyboard is used in html, input is set to readonly property, how to get input focus again?
Next: WeChat Mini Programs test, only my WeChat account test has no problem.
see the following changes in Android P Behavior Changes FLAG_ACTIVITY_NEW_TASK requirement is now enforced With Android P, you cannot start an activity from a non-activity context unless you pass the intent flag FLAG_ACTIVITY_NEW_TASK. If you attem...
has anyone ever encountered a similar problem? After the simulator project was started, the Emulator ERROR: detected a hanging thread QEMU2 main loop . was reported wrong directly. No response for 15001 ms ...
android if the user is not logged in, skip to the login page where should this logic be implemented in activity? ...
how to dynamically replace the title bar of different activity? The elements on the title bar are different on different activity. Thank you ...
how can I use android.support.design.widget.BottomSheetDialogFragment to set a peekHEIGHT, similar to BottomSheetBehavior to achieve a collapsed state? two main problems: 1. Achieve a folded state, rather than simply disappear after sliding. 2. Whe...
because the audio file is too long for users to listen to at one time, I hope users can listen to it directly from what they have heard next time, but the seekTo () method is invalid because my audio file is encrypted by AES. ...
such as the title. uses implicit intent to select the file, obtains the file path, crashes after using Typeface.createFromFile (String path). Typeface typeface = Typeface.createFromFile(" storage emulated 0 Download fzzxh_gbk.ttf"); textVi...
android starts downloading files with a click of activity. If activity is destroyed, will the download continue ...
1. Using Android webview development, the js and click events in the written html can be triggered, but the ajax request cannot be sent. Why? ...
do fragments in activity1 and fragments in activity2 use the same fragmentmanager? activity2 add fragment Times error ...
looked for several wheels and found it was not good! So I want to write how to make the above thumb show a negative value to follow the scrolling of seekbar if you have wheels, you can also recommend it to me. Thank you! the seekBar of the system c...
has enabled Google Drive API, according to the example on the page below, but still cannot upload. There should be no problem with the code of app. Is there anything else that has not been opened or set up in api? checked, some people said to enable b...
such as the title. 1. Does direct replication or overwrite result in data loss when exporting or importing? 2. In addition, does the .db-journal file also need to be exported or imported with the .db file? 3. Is it possible to export or import datab...
now the server side of our company needs me to upload string data + pictures through the post form. I have tried to annotate the parameters with Multipart annotations plus PartMap, but the server cannot receive the image resources, and I have strictly f...
because the number of code methods exceeds 65535 and cannot be packaged, I introduced MultiDex subpackages. when I finished packing, one of the kotlin functions that I ran into the class went wrong, causing the program to crash. has looked up a lo...
I saw Listview today. After trying according to the code in the article, I found that I had reported an error. I read it several times and found that I didn t bring the wrong code. How to solve the problem by seeking friends? MainActivity.java ...
give me a brief answer and describe my question. my purpose is to visit website A, but if I do not log in to website A directly, I will be redirected to website B. that is to say, I must go through the login operation of website B to access the target ...
similar to the implementation of data-x in HTML, you can dynamically set and get the property values of the control through the code. (application scenario: a TextView list, text attribute is username, click to get custom age attribute) ...
when I use Android camera recording while taking camera frame data for algorithm processing, I use mediaRecorder for recording and algorithm processing in onPreviewFrame. the video recording is normal when using mediaRecorder alone. The callback is nor...
ask for advice, how to solve this error? E: cordova-demo>cordova requirements Android Studio project detected Requirements check results for android: Java JDK: installed 1.8.0 Android SDK: installed true Android target: not installed cmd: Command...