UPDATE code is: but when you select 2 edit, the focus returns to 1 edit. I tried to play clearFocus () parameters, but it does not help ..
@Override public View getView(final int position, View convertView, ViewGroup parent) { View view = convertView; if (view == null) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.custom_list_tovar, parent, false); currentPosition = position; holder = new ViewHolder(); holder.title = (TextView) view.findViewById(R.id.title); holder.edit_name_tovar = (Spinner) view.findViewById(R.id.edit_name_tovar); holder.edit_mark_tovar = (EditText) view.findViewById(R.id.edit_mark_tovar); holder.edit_cost_tovar = (EditText) view.findViewById(R.id.edit_cost_tovar); holder.add_button_tovar = (Button) view.findViewById(R.id.add_button_tovar); holder.trash_button = (ImageButton) view.findViewById(R.id.trash_button); view.setTag(holder); } else { holder = (ViewHolder) view.getTag(); } emptyAdapter = new ArrayAdapter<String>(context, R.layout.custom_items_list, R.id.items, list_tov); holder.edit_name_tovar.setAdapter(emptyAdapter); holder.title.setText("Товар_1"); holder.edit_mark_tovar.setOnFocusChangeListener(this); holder.edit_cost_tovar.setOnFocusChangeListener(this); if (holder.edit_mark_tovar.hasFocus()) { holder.edit_mark_tovar.addTextChangedListener(new AddListenerOnTextChange(holder.edit_mark_tovar)); notifyDataSetChanged(); } if (holder.edit_cost_tovar.hasFocus()) { holder.edit_cost_tovar.addTextChangedListener(new AddListenerOnTextChange(holder.edit_cost_tovar)); notifyDataSetChanged(); } //holder.edit_cost_tovar.setMask("dd ddd dd"); return view; } @Override public void onFocusChange(View v, boolean hasFocus) { switch (v.getId()) { case R.id.edit_mark_tovar: //holder.edit_cost_tovar.clearFocus(); if (hasFocus) { handler.postDelayed(new Runnable() { @Override public void run() { if (lastFocussedPosition == -1 || lastFocussedPosition == currentPosition) { lastFocussedPosition = currentPosition; holder.edit_mark_tovar.requestFocus(); } } }, 200); } else { lastFocussedPosition = -1; } break; case R.id.cost_tovar: //holder.edit_mark_tovar.clearFocus(); if (hasFocus) { handler.postDelayed(new Runnable() { @Override public void run() { if (lastFocussedPosition == -1 || lastFocussedPosition == currentPosition) { lastFocussedPosition = currentPosition; holder.edit_cost_tovar.requestFocus(); } } }, 200); } else { lastFocussedPosition = -1; } break; } } Listview xml:
<ListView android:id="@+id/list_tovar" android:layout_width="match_parent" android:layout_height="0dp" android:descendantFocusability="afterDescendants" android:layout_weight=".50"> EditText xml:
<EditText android:id="@+id/edit_cost_tovar" android:hint="Введите сумму" android:focusable="true" android:focusableInTouchMode="true" android:inputType="numberDecimal" style="@style/item_list_tovar"/>