title: Edittext  in Listview android
body: <p>I have Listview with editext and textview.</p>
  
  <p>When i touch on edittext then edittext lost focus!</p>
  
  <p>I resolved this problem by setting <code>android:windowSoftInputMode="adjustPan"(AndroidManifest.xml)</code>.
  Now i touch on edittext than editext get focus but application label and some raw of listview disappear(top part).</p>
  
  <p>I want to get focus when user touch on edittext without loss application label and some raw of listview.</p>
  
  <p>Code that i have implemented :</p>
  
  <p>Below coding get focus when user touch on edittext but application label and some raw of listview disappear when soft keypad pop up.I want to get focus when user touch on edittext without loss application label and some raw of listview.</p>
  
  <p>1)AndroidManifest.xml</p>
  
  <pre><code>&lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt;
          &lt;activity android:name=".MyListViewDemoActivity"
                    android:label="@string/app_name"
                    android:windowSoftInputMode="adjustPan"
                    &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
  
  &lt;/application&gt;
  </code></pre>
  
  <p>2) raw_layout.xml</p>
  
  <pre><code>&lt;LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"&gt;
    &lt;EditText android:id="@+id/mEditText"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    /&gt;  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>3) main.xml</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      &gt;
  &lt;ListView android:id="@+id/mListView"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>4) MyListViewDemoActivity</p>
  
  <pre><code>public class MyListViewDemoActivity extends Activity {
      private ListView mListView;
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          mListView=(ListView)findViewById(R.id.mListView);
          mListView.setAdapter(new MyAdapter(this));
      }
  }
  
  class MyAdapter extends BaseAdapter {
  
      private Activity mContext;
      private String character[]={"a","b","c","d","e","f","g","h","i","j"};
      public MyAdapter(Activity context)
      {
          mContext=context;
      }
  
      @Override
      public int getCount() {
          // TODO Auto-generated method stub
          return character.length;
      }
  
      @Override
      public Object getItem(int position) {
          // TODO Auto-generated method stub
          return null;
      }
  
      @Override
      public long getItemId(int position) {
          // TODO Auto-generated method stub
          return 0;
      }
  private class Holder
  {
      EditText mEditText;
  }
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          // TODO Auto-generated method stub
          final Holder holder;
          if (convertView == null) {
              holder = new Holder();
              LayoutInflater inflater =mContext.getLayoutInflater();
              convertView = inflater.inflate(R.layout.raw_layout, null);
              holder.mEditText = (EditText) convertView
                      .findViewById(R.id.mEditText);
              convertView.setTag(holder);
          } else {
              holder = (Holder) convertView.getTag();
          }
          holder.mEditText.setText(character[position]);
          holder.mEditText.setOnFocusChangeListener(new OnFocusChangeListener() {
  
              @Override
              public void onFocusChange(View v, boolean hasFocus) {
                  // TODO Auto-generated method stub
                  if (!hasFocus){
                      final EditText etxt = (EditText) v;
                      holder.mEditText.setText(etxt.getText().toString());
                  }
  
              }
          });
          return convertView;
      }
  
  }
  </code></pre>