android-edittext

Make soft keyboard behave like IOS in Android

僤鯓⒐⒋嵵緔 提交于 2019-12-13 02:40:05
问题 I have a layout which I placed my widgets proportionally with weight attribute. I don't want to use scrollView, I want my widgets to fit onto screen according to their weights. However, I want my layout to be scrollable when soft keyboard pops up. I don't want it to be resized so I can't use android:windowSoftInputMode="adjustResize" I tried android:windowSoftInputMode="adjustPan" and it moves the edittext field above the soft keyboard. However, this time it does not scroll and I have to

Android EditText unlimited text length

一世执手 提交于 2019-12-13 02:05:16
问题 is there a device specific limitation (other then total free memory size) to text length or line count in scrollable multiline EditText when android:maxLength and android:maxLines is NOT set? I have an EditText: <EditText android:editable="false" android:id="@+id/sip_log_log" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight = "1" android:text="" android:gravity = "top" android:textColor="#00FF00" android:background="#000000" android:scrollbars=

EditText return back previously input data after pressed back button

倖福魔咒の 提交于 2019-12-13 01:34:39
问题 I have an application login system type of application. Once the user pressed back button after login, the username and password EditText are filled with what the user enter just now. Is there any way to clear the EditText to empty? Sorry that if I make this sounds confusing. Any comment will be appreciated! 回答1: you can do this by overriding onPause method of Activity and in onPause method clear all EditText Value as: @Override protected void onPause(){ super.onPause(); // Clear all value

Android: Two EditTexts dependent on each other

谁说胖子不能爱 提交于 2019-12-13 01:25:44
问题 I have two EditTexts. One is for example temperature in °C and the other is temperature in °F. When user edits one EditTexts I want the other to change accordingly. Problem is that this changes make loop, where EditTexts make changes of each other. How to solve this? I would like to still have reaction in other EditText when I change the first one even programmatically, but without loop... 回答1: Check if each EditText has focus first and only change it programmatically if it doesn't have focus

How to show all edittext error messages at once in android?

馋奶兔 提交于 2019-12-12 22:14:24
问题 I have two EditTexts and I am applying validations on them. If the validations fail, I want to show all the error messages at once. At a time, I'm getting only one error message which is fixed to the bottom EditText field. How to show all the EditText error messages at once?? I am using the following code: if(uname.matches("")) username.setError("Email is required"); if(pwd.matches("")) password.setError("Password is required"); my screen shot is: 回答1: You have to setError(null) in else

Send data from edittext to listview

拜拜、爱过 提交于 2019-12-12 21:30:11
问题 I have created two Activities ( MainActivity , ListActivity ) and in MainActivity , I have an EditText and a save-button. In ListActivity , I have a ListView . I want to save the value/data/string text that is written in EditText and send it to the other Activity in the ListView . This is how it looks now, but I think I know what I'm missing but don't know how to do it. MainActivity. public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) {

Android Spannable text save/store issue

梦想的初衷 提交于 2019-12-12 19:51:57
问题 I got a edittext and it has multiple coloured text like that code below. Is there any way to store text and colours and show them again? I used to use SharedPreference to store strings integers etc. but this isn`t working for Spannables. Spannable span1 = new SpannableString("this"); Spannable span2 = new SpannableString("is"); Spannable span3 = new SpannableString("text"); span1.setSpan(new ForegroundColorSpan(Color.parseColor("#292929")), 0, span1.length(),Spannable.SPAN_EXCLUSIVE_EXCLUSIVE

Check the font size, height, and width of the EditText with Espresso

帅比萌擦擦* 提交于 2019-12-12 19:15:51
问题 How could I check the font size, height, and width of an EditText with Espresso? At the moment to sect the text I use: onView(withId(R.id.editText1)).perform(clearText(), typeText("Amr")); And to read the text: onView(withId(R.id.editText1)).check(matches(withText("Amr"))); 回答1: You will have to create your own custom matchers since Espresso does not support any of these matchers by default. Luckily this can be done quite easily. Take a look at this example for font size: public class

Adding EditText to a layout in android with for-loop

你说的曾经没有我的故事 提交于 2019-12-12 18:48:03
问题 let me introduce you to my issue: I have just begun with programming for android. Now I want to create a little app that asks for the amount of players and then a new screen pops up with as many as EditText fields as the amount of players. Example: I type in the amount of players (4), then I press send, the next screen is filled with 4 EditText fields asking for the players names. Here's the code: Method that asks for the amount of players: public void gaVerder (View view){ Intent i = new

Android validate EditText inside an AlertDialog

我的梦境 提交于 2019-12-12 18:27:42
问题 I'm trying to validate some EditTexts inside an alert dialog, but when I click on the "OK" button the alert simply dismiss, as you can see in my code I have a error message that should appear if the field is empty, what am I missing here, any help would be appreciated. final TextView id = (TextView) spinner.getSelectedView(); final EditText descricao = (EditText) v.findViewById(R.id.add_descricao); final EditText observacao = (EditText) v.findViewById(R.id.add_observacao); final EditText data