android-edittext

How to set edittext preference summary and have it stick

戏子无情 提交于 2021-01-27 03:37:40
问题 I have gone back and fourth on this and I just can not get it. I am setting up my settings using a preference fragment. I can get the settings to work and I can even get the "summary" to update when I make the change. But if I leave the settings screen and come back to it, the summary is back to the default text. So the question is, when using an edittext preference. How do you update the summary so it shows what the user changed the setting to and make it stick across closing the screen and

How to make TextInputLayout hint asterisk red for required fields

﹥>﹥吖頭↗ 提交于 2021-01-16 08:13:32
问题 Is it possible to make just the asterisk in the hint red when using a TextInputLayout from the design support library? I have seen information on styling the entire hint, but this is a little more complex since only the * should be red, not the whole message. The Material Design example shows this, but the design library doesn't seem to have any option to style it this way using a TextInputLayout and EditText. Reference: https://www.google.com/design/spec/components/text-fields.html#text

How to make TextInputLayout hint asterisk red for required fields

杀马特。学长 韩版系。学妹 提交于 2021-01-16 08:12:05
问题 Is it possible to make just the asterisk in the hint red when using a TextInputLayout from the design support library? I have seen information on styling the entire hint, but this is a little more complex since only the * should be red, not the whole message. The Material Design example shows this, but the design library doesn't seem to have any option to style it this way using a TextInputLayout and EditText. Reference: https://www.google.com/design/spec/components/text-fields.html#text

How to make TextInputLayout hint asterisk red for required fields

五迷三道 提交于 2021-01-16 08:11:30
问题 Is it possible to make just the asterisk in the hint red when using a TextInputLayout from the design support library? I have seen information on styling the entire hint, but this is a little more complex since only the * should be red, not the whole message. The Material Design example shows this, but the design library doesn't seem to have any option to style it this way using a TextInputLayout and EditText. Reference: https://www.google.com/design/spec/components/text-fields.html#text

How to make TextInputLayout hint asterisk red for required fields

≯℡__Kan透↙ 提交于 2021-01-16 08:10:33
问题 Is it possible to make just the asterisk in the hint red when using a TextInputLayout from the design support library? I have seen information on styling the entire hint, but this is a little more complex since only the * should be red, not the whole message. The Material Design example shows this, but the design library doesn't seem to have any option to style it this way using a TextInputLayout and EditText. Reference: https://www.google.com/design/spec/components/text-fields.html#text

How to add two edit text fields or views in an AlertDialog box?

孤街浪徒 提交于 2020-12-28 07:29:04
问题 I want to add two edit text fields in an alert dialog box. As simple as the solution sounds I have not been able to gather a working one as of yet. I am not able to set the two (edit text) views simultaneously. Please comment in case you want to see any further code. alertDialog.setTitle("Values"); final EditText quantity = new EditText(SecondScan.this); final EditText lot = new EditText(SecondScan.this); quantity.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);

How to set focus to editText when fragment start?

邮差的信 提交于 2020-12-12 03:58:54
问题 When MyFgment appear in screen, I want to set cursor focus on EditText in MyFragment automatically. I've tried EditText.requestFocus() , but it doesn't focus on EditText . How can I do?? 回答1: editText.requestFocus() will put focus to your View if it is focusable . But I guess you want to show keyboard when it is focused. If I am right then the following code might work for you. editText.requestFocus(); InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)

Remove focus from all Edit Text after click on OK from Alert Dialog

穿精又带淫゛_ 提交于 2020-12-12 02:18:07
问题 My Activity contain three EditText and one button. I set custom AlertBox for get the User input on one EditText. When I click on OK button from Alert Box , Focus Automatically goes to First EditText. I used editext.clearFocus(); I also tried editText.clearFocus(); editText.setEnabled(false); But doesn't work. How to remove focus in All EditText after click on OK from AlertDialog. Thanks in Advance. 回答1: To clear focus and remove cursor from editText editText.clearFocus(); editText

How to set different colors for each characters written in edittext in Android?

耗尽温柔 提交于 2020-12-06 16:00:28
问题 I am trying make characters written in edittext colored with a different color. For example, I want to have 'a' in red all the time when it is written in edittext , while the others stay in black. Is it possible at least? I found some answers regarding color-setting in edittext as below, however it is all about color-setting by the range of start index and end index. ** example ** final String text = "for example"; Spannable modifiedText = new SpannableString(text); modifiedText.setSpan(new

How to apply shapeAppreanace in EditText and TextView using Material Design in Android

时光怂恿深爱的人放手 提交于 2020-11-29 08:46:53
问题 I want to design a TextView and EditText with round corner. There is one straight forward solution for this. Using custom shape background. But since material design 1.1.0 introduces shapeAppearance theme attribute to apply a different shape to the corner which works fine for all Material components like MaterialButton , BottomSheet , MaterialCardView , etc. But it does not work for EditText and TextView . I tried using MaterialTextView as well but it did not work. This how I am setting up