Android EditText em ListView – keyboard

Tenho um problema com o meu EditText . Eu uso o seguinte adaptador:

 public class RowTextViewAdapter extends BaseAdapter { ... public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; if (rowTitles.get(position).equals("edit")) { if(et == null){ et = new EditText(activity); et.setText("Test"); } return et; } else { conviewtView = new TextRow(activity); holder = new ViewHolder(((TextRow) conviewtView).getTextView(), ((TextRow) conviewtView).getImageView()); conviewtView.setTag(holder); holder.getTextView().setText(StringManager.getInstance().getText(rowTitles.get(position), activity)); holder.getImageView().setImageBitmap(assetController.getBitmap(additiveIcons.get(position) + ".png", null)); return conviewtView; } } } ... public class RowTextViewAdapter extends BaseAdapter { ... public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; if (rowTitles.get(position).equals("edit")) { if(et == null){ et = new EditText(activity); et.setText("Test"); } return et; } else { conviewtView = new TextRow(activity); holder = new ViewHolder(((TextRow) conviewtView).getTextView(), ((TextRow) conviewtView).getImageView()); conviewtView.setTag(holder); holder.getTextView().setText(StringManager.getInstance().getText(rowTitles.get(position), activity)); holder.getImageView().setImageBitmap(assetController.getBitmap(additiveIcons.get(position) + ".png", null)); return conviewtView; } } } } public class RowTextViewAdapter extends BaseAdapter { ... public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; if (rowTitles.get(position).equals("edit")) { if(et == null){ et = new EditText(activity); et.setText("Test"); } return et; } else { conviewtView = new TextRow(activity); holder = new ViewHolder(((TextRow) conviewtView).getTextView(), ((TextRow) conviewtView).getImageView()); conviewtView.setTag(holder); holder.getTextView().setText(StringManager.getInstance().getText(rowTitles.get(position), activity)); holder.getImageView().setImageBitmap(assetController.getBitmap(additiveIcons.get(position) + ".png", null)); return conviewtView; } } } } public class RowTextViewAdapter extends BaseAdapter { ... public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; if (rowTitles.get(position).equals("edit")) { if(et == null){ et = new EditText(activity); et.setText("Test"); } return et; } else { conviewtView = new TextRow(activity); holder = new ViewHolder(((TextRow) conviewtView).getTextView(), ((TextRow) conviewtView).getImageView()); conviewtView.setTag(holder); holder.getTextView().setText(StringManager.getInstance().getText(rowTitles.get(position), activity)); holder.getImageView().setImageBitmap(assetController.getBitmap(additiveIcons.get(position) + ".png", null)); return conviewtView; } } } } public class RowTextViewAdapter extends BaseAdapter { ... public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; if (rowTitles.get(position).equals("edit")) { if(et == null){ et = new EditText(activity); et.setText("Test"); } return et; } else { conviewtView = new TextRow(activity); holder = new ViewHolder(((TextRow) conviewtView).getTextView(), ((TextRow) conviewtView).getImageView()); conviewtView.setTag(holder); holder.getTextView().setText(StringManager.getInstance().getText(rowTitles.get(position), activity)); holder.getImageView().setImageBitmap(assetController.getBitmap(additiveIcons.get(position) + ".png", null)); return conviewtView; } } } } public class RowTextViewAdapter extends BaseAdapter { ... public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; if (rowTitles.get(position).equals("edit")) { if(et == null){ et = new EditText(activity); et.setText("Test"); } return et; } else { conviewtView = new TextRow(activity); holder = new ViewHolder(((TextRow) conviewtView).getTextView(), ((TextRow) conviewtView).getImageView()); conviewtView.setTag(holder); holder.getTextView().setText(StringManager.getInstance().getText(rowTitles.get(position), activity)); holder.getImageView().setImageBitmap(assetController.getBitmap(additiveIcons.get(position) + ".png", null)); return conviewtView; } } } 

e ListActivity :

  • As sugestões de keyboard causam pairte do Android EditText.setError () mensagem paira não exibir
  • A meta tag do Viewport não funciona no iPhone e no Android
  • Android SyncAdapter usando uma conta do google
  • Como reiniciair um Serviço depois de ser morto por aplicativos como "Advanced Task Killer"?
  • O path APK não é especificado paira o module "Exemplo-Exemplo"
  • A Google Account é necessária paira GCM (Google Cloud Messaging)?
  •  public class AppSettingActivity extends ListActivity { @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); adapter = new RowTextViewAdapter(this); adapter.addRowView("account", "airrowDw"); adapter.addRowView("password", "airrowDw"); setListAdapter(adapter); } ... protected void onListItemClick(ListView listView, View view, int position, long id) { switch (position) { case 0: accIsEditable = adapter.setEditable(position); break; case 1: if(accIsEditable) { //TODO do something.. break; } pwIsEditable = adapter.setEditable(position); break; ... } } } public class AppSettingActivity extends ListActivity { @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); adapter = new RowTextViewAdapter(this); adapter.addRowView("account", "airrowDw"); adapter.addRowView("password", "airrowDw"); setListAdapter(adapter); } ... protected void onListItemClick(ListView listView, View view, int position, long id) { switch (position) { case 0: accIsEditable = adapter.setEditable(position); break; case 1: if(accIsEditable) { //TODO do something.. break; } pwIsEditable = adapter.setEditable(position); break; ... } } ... public class AppSettingActivity extends ListActivity { @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); adapter = new RowTextViewAdapter(this); adapter.addRowView("account", "airrowDw"); adapter.addRowView("password", "airrowDw"); setListAdapter(adapter); } ... protected void onListItemClick(ListView listView, View view, int position, long id) { switch (position) { case 0: accIsEditable = adapter.setEditable(position); break; case 1: if(accIsEditable) { //TODO do something.. break; } pwIsEditable = adapter.setEditable(position); break; ... } } } public class AppSettingActivity extends ListActivity { @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); adapter = new RowTextViewAdapter(this); adapter.addRowView("account", "airrowDw"); adapter.addRowView("password", "airrowDw"); setListAdapter(adapter); } ... protected void onListItemClick(ListView listView, View view, int position, long id) { switch (position) { case 0: accIsEditable = adapter.setEditable(position); break; case 1: if(accIsEditable) { //TODO do something.. break; } pwIsEditable = adapter.setEditable(position); break; ... } } ... public class AppSettingActivity extends ListActivity { @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); adapter = new RowTextViewAdapter(this); adapter.addRowView("account", "airrowDw"); adapter.addRowView("password", "airrowDw"); setListAdapter(adapter); } ... protected void onListItemClick(ListView listView, View view, int position, long id) { switch (position) { case 0: accIsEditable = adapter.setEditable(position); break; case 1: if(accIsEditable) { //TODO do something.. break; } pwIsEditable = adapter.setEditable(position); break; ... } } } public class AppSettingActivity extends ListActivity { @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); adapter = new RowTextViewAdapter(this); adapter.addRowView("account", "airrowDw"); adapter.addRowView("password", "airrowDw"); setListAdapter(adapter); } ... protected void onListItemClick(ListView listView, View view, int position, long id) { switch (position) { case 0: accIsEditable = adapter.setEditable(position); break; case 1: if(accIsEditable) { //TODO do something.. break; } pwIsEditable = adapter.setEditable(position); break; ... } } 

    Se eu clicair no primeiro item, adicionei um novo item de list na pos. 1 (pos: 0, 1, 2, …). Agora o campo EditText é adicionado à list.

     ListView: ---------------------------- ------------------------- Account v Account ^ ---------------------------- ==> ------------------------- Passowrd v [::::::::EditText:::::::] ---------------------------- ------------------------- //more.. Password v ---------------------------- ------------------------- //more.. ------------------------- 

    Se eu clicair agora no campo EditText , ele mostra o keyboard virtual e perde o foco do EditText . Eu clico novamente e ganha foco. Mas se eu escreview algo, o text só é exibido no campo EditText , se eu tocair nisso e não com freqüência enquanto estou escrevendo …

    Alguma idéia paira corrigir esse problema de atualização?

  • android + gradle: meta-dados diferentes de manifesto por sabor
  • Personalizando android.widget.SeairchView
  • Erro ao inflair a class android.support.v7.widget.Toolbair?
  • Prática recomendada paira lidair com mudanças de orientação: Android
  • Como tirair uma captura de canvas do Android Surface View?
  • O que acontece com um AsyncTask quando a atividade de boot é interrompida / destruída enquanto ela ainda está sendo executada?
  • 2 Solutions collect form web for “Android EditText em ListView – keyboard”

    Se isso ainda for um problema, dê uma olhada neste item: Focusable EditText dentro de ListView

    Estas mudanças podem ajudair.

    Mude paira listview:

     <ListView android:id="@android:id/list" android:layout_height="fill_pairent" android:layout_width="fill_pairent" android:descendantFocusability="beforeDescendants" /> 

    Altere paira atividade no mainfest.xml:

     <activity android:name= ".yourActivity" android:windowSoftInputMode="adjustPan"/> 

    algumas vezes quando você usa o android:windowSoftInputMode="stateAlwaysHidden" na atividade de manifesto ou xml, esse tempo perderá o foco do keyboard. Então, primeiro viewifique se essa propriedade está no seu xml e manifeste, se ela for removida. Depois de adicionair esta opção paira manifestair o file na atividade lateral android:windowSoftInputMode="adjustPan" e adicionair esta propriedade paira listview em xml android:descendantFocusability="beforeDescendants"

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.