android-edittext

Android ScaleAnimation doesn't scale clickable area

牧云@^-^@ 提交于 2019-11-29 10:19:37
问题 I have a layout structured as follows: LinearLayout1 LinearLayout2 EditText I am applying a ScaleAnimation to LinearLayout1 using a LayoutAnimationController so that all of the views in the hierarchy are scaled by the same amount. After applying the ScaleAnimation, the views are all scaled correctly, but the EditText no longer responds to clicks that fall outside the space it originally occupied. In other words, it appears that the clickable area for the EditText does not scale along with the

Why does the input value in EditText swaps its position while scrolling in a RecyclerView?

家住魔仙堡 提交于 2019-11-29 09:34:26
问题 After putting an input in the EditText, if a scroll up or down very fast the input values swaps its position in another EditText in a RecyclerView. Before scrolling the data was in the first EditText. After scrolling up and down the value of the first EditText changed its postion to the 4th one and the swapping is random. Is there any work around to steady the data. Here is a sample screenshot Here is the Model Class: public class Product { public int pId; public String pName; public double

android format edittext to display spaces after every 4 characters

拟墨画扇 提交于 2019-11-29 09:25:11
Android - I want to get a number input from the user into an EditText - it needs to be separated by spaces - every 4 characters. Example: 123456781234 -> 1234 5678 1234 This is only for visual purpose. However i need the string without spaces for further usage. What is the easiest way I can do this? You need to use TextWatcher to achieve visual purpose spaces. And use any simply split string by space logic to join it back or loop through the entire string per character wise and eliminate (char) 32 from the string is this editext for credit card? first create count variable int count = 0; then

edittext.settext() changes the keyboard type to default [ from ?123 to ABC]

廉价感情. 提交于 2019-11-29 09:22:35
I have following code for my edittext formatting, since it can take any input I am not setting any input type: if (cardNumberEditText != null) { cardNumberEditText.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { int currSel = cardNumberEditText.getSelectionStart(); cardNumberEditText.removeTextChangedListener(textWatcher); . . cardNumberEditText.setText(formattedNumber); . . cardNumberEditText.setSelection(currSel); cardNumberEditText.addTextChangedListener(textWatcher); } @Override public void beforeTextChanged

How to stop Soft keyboard showing automatically when focus is changed (OnStart event)

╄→尐↘猪︶ㄣ 提交于 2019-11-29 09:04:45
I am developing for a tablet using Android 2.2. I have a form which I am using for new and editable instances. When editable, I want to stop the user from editing certain fields. I manage this in my onStart -event, setting the txt.setFocusableInTouchMode(false) . This forces the focus to the next focusable EditText in my form (which is great), but when running, the soft keyboard automatically appears for the EditText with the focus. Anybody know how to stop this? Here's the code (called in the onStart event): private void PopulateFields(){ TextView txtTitle = (TextView) this.findViewById(R.id

Testing with UI elements in Android view

僤鯓⒐⒋嵵緔 提交于 2019-11-29 08:59:10
问题 I am attempting to test simple UI with the following test case, The main idea is to set in the test some of the UI text (to mimic user input) and then actively click an event. public class StackTestCase extends ActivityInstrumentationTestCase2<Stack> { private StackDemo mActivity; private EditText eaten; public StuckTestCase() { super("com.crocodil.software.stack", Stack.class); } public StuckTestCase(Class<Stack> activityClass) { super("com.crocodil.software.stack", activityClass); }

Android: Evaluate EditText after the user finishes editing

为君一笑 提交于 2019-11-29 08:01:47
What I want I have an EditText, where the user can enter a value, such as 10.40. Once the user is done editing I am formatting his input to a currency, for instance the above mentioned value would get formatted to $10.40 (in the case of Locale.US). And I display that result in the same EditText that the user previously edited. Problem Because I am going to format (i.e. modify) his input, I need to know when he's done (so my formatting does not interfer with his ongoing input). What I tried TextWatcher is not an option, since it fires on every single edit, hence when the user enters one, zero,

EditText Loses Focus on Click

你离开我真会死。 提交于 2019-11-29 07:49:52
I'm writing an activity to list a bunch of items from the database and show an additional column with a quantity. I implemented an ArrayAdapter to show my custom layout. Here is the code of the most important parts of the Adapter: static class ViewHolder { protected TextView text; protected EditText editText; } @Override public View getView(int position, View convertView, ViewGroup parent) { View view = null; if (convertView == null) { LayoutInflater inflator = context.getLayoutInflater(); view = inflator.inflate(R.layout.rowquantitylayout, null); final ViewHolder viewHolder = new ViewHolder()

Issues focusing EditTexts in a ListView (Android)

一笑奈何 提交于 2019-11-29 07:26:28
I have a ListView with a few EditTexts in each item. I have no issues with a hardware keyboard, but things freak out a bit with the soft keyboard. I have two issues. When I first click on an EditText, it briefly appears to have focus but then loses focus once the keyboard has shown. I must then click the EditText again to get focus. When an EditText with focus is scrolled out of view, focus goes to... well... see the screenshot. I'm not sure what's happening. More details on #1: When the screen first loads, focus is in the "Gr High School Scale" field, but the keyboard is not shown. If I

Android - Adjust screen when keyboard pops up?

半世苍凉 提交于 2019-11-29 07:08:29
I want to be able to adjust my UI screen on Android when the soft keyboard pops up. So at the minute I have something similiar to the first picture below where I have and EditText at the bottom of the screen and when a user taps the EditText I want the same as what happens in the second picture. That is that the EditText gets moved up and appears to "sit" on top of the soft keyboard, when the soft keyboard dissapears it should then return to its prior state. Can anyone let me know the best way to approach and implement this? alt text http://img40.imageshack.us/img40/2300/keyboarddown.png alt