android-edittext

Overriding editTextStyle doesn't work with latest Material Components base style

时间秒杀一切 提交于 2020-05-25 07:41:47
问题 In an app of mine, I'm using the Theme.MaterialComponents.Light.NoActionBar as a base style. In this style, which I call AppTheme , I'm trying to override editTextStyle to provide a custom style for com.google.android.material.textfield.TextInputEditText (according to the source code, it uses R.attr.editTextStyle as a default style). This is my current theme, related to the TIEditText and TILayout: <style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar"> [ primary and

EditText ,Entered text not visible full

穿精又带淫゛_ 提交于 2020-05-24 05:55:06
问题 A sample code where i need to have a Edit Text in a Grid Layout Programatically .But when the text are entered in the app ,Only the small bottom portion of text is visible .The text is larger than expected. I need the edit text with text as shown in image which is Edit Text green background with only one line edit text required.Thanks package com.example.myapplicationtesting; import androidx.appcompat.app.AppCompatActivity; import android.annotation.SuppressLint; import android.os.Bundle;

EditText Multiple Edit Fill check

放肆的年华 提交于 2020-05-24 05:21:10
问题 i am creating a project in which i have 3 Edit text filled i want to check if from 3 edit text any one should be filled any one from either 3 edit text i know how to check if all there is data in all edittext values private boolean validate_edit1() { string1= edit1.getText().toString().trim(); if (string1.isEmpty()) { edit1.requestFocusFromTouch(); edit1.setAnimation(shakeError()); edit1.setError(""); return false; } else { edit1.setFocusable(false); } return true; } private boolean validate

EditText not set after device rotation

血红的双手。 提交于 2020-05-16 05:18:30
问题 Steps are as follows: 1. Run app -> OK, EditText set to "hello" 2. Clear text manually 3. Rotate the device What I expect is that EditText is set again to "hello" because activity is recreated after rotation. However, EditText is empty. Code: public class MainActivity extends AppCompatActivity { EditText editText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); editText = (EditText) findViewById(R.id

EditText not set after device rotation

假装没事ソ 提交于 2020-05-16 05:18:08
问题 Steps are as follows: 1. Run app -> OK, EditText set to "hello" 2. Clear text manually 3. Rotate the device What I expect is that EditText is set again to "hello" because activity is recreated after rotation. However, EditText is empty. Code: public class MainActivity extends AppCompatActivity { EditText editText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); editText = (EditText) findViewById(R.id

setKeyListener will override setInputType and change the keyboard

怎甘沉沦 提交于 2020-05-13 07:33:20
问题 Hi everyone I'm having a problem between two devices. In practice using the InputType and the KeyListener I'm manipulating an EditText to make it receive the commas and numbers from the numeric pad (for more background check my previous question). Using the following code I'm able to do something like that: editText.setInputType(InputType.TYPE_CLASS_NUMBER + InputType.TYPE_NUMBER_FLAG_DECIMAL); editText.setKeyListener(DigitsKeyListener.getInstance("0123456789,")); Unfortunately this doesn't

Relation of EditText with its Id in Android Studio?

大城市里の小女人 提交于 2020-04-30 09:19:55
问题 I am learning Activity LifeCycle . I only have one EditText and a TextView in my XML layout. When I rotate the screen, nothing seems to change. But when I remove the id of EditText in XML and rotated the screen, The text in the editText removed. I am confused about the relation of EditText with its Id. MainActivity.java is empty and main_activity.xml code is below: Below, After Removing the id of EditText in XML , The text was removed when I rotated the screen. <?xml version="1.0" encoding=

How to clear formatting from an EditText?

时光总嘲笑我的痴心妄想 提交于 2020-04-30 07:23:26
问题 I have an EditText , and can add formatting such as bold, italic....but how can I remove it? I've looked into getSpans, filters, and other non-string things and haven't been able to make sense of them! Ideally, I'd like to be able to clear specific tags and all tags set around the selected text. Update with my solution: private String getSelectedText(){ int start = Math.max(mText.getSelectionStart(), 0); int end = Math.max(mText.getSelectionEnd(), 0); return mText.getText().toString()

Android Move cursor from one EditText to another one?

随声附和 提交于 2020-04-29 19:40:19
问题 I know these type of question asked many time .but still nobody gave perfect answer for that. I have question : I want to move from EditText1 ** to another **EditText2 . I had already detect to editText1 but how to move cursor to editText2.? In short I had to move my cursor position from one editText1 to another EditText2 directly. 回答1: I faced this type of issue and found the solution as below. Here I have two editText , if I press "a", my cursor will move to next step . I used below code

Dynamic leading text for android's EditText

北战南征 提交于 2020-04-17 22:06:08
问题 I've looked into using a TextWatcher and an InputFilter , but I'm not too sure how to approach this problem. The idea is to have an EditText that inserts text from right to left. As the use input changes, I would like the following to occur. - User enters "1" -> Text formats as 00:01 - User enters "2" -> Text formats as 00:12 - User enters "8" -> Text formats as 01:28 How could I approach this? Inputfilter seems to be for excluding text and using setText inside the TextWatcher appears to run