I have a ListView to display category items, below this, I have a control menu writen in a LinerLayout, and, also an EditText and go Button at the top of this app.
Everything is fine at the first running time. however, when I click the EditText for input, the menu bar is pulled up since the keyboard appear. Now, the order of the ListView has been changed.
example:
at beginning: 1 Meeting 2 Event 3 Schedule 4 Reminder
Later keyboard shows and everything pulled up: 1 Schedule 2 Reminder 3 Meeting 4 Event.
I also find that this problem will only happen when there is no enough space to keep showing the whole ListView.
I can’t solve this problem after I searched for long time on the internet.
This is my layout and my List Apdater
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout ...>
<ListView
android:id="@+id/items"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/widget53"/>
<LinearLayout
android:id="@+id/widget39"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" >
<ImageButton ../>
<ImageButton ../>
<ImageButton ../>
</LinearLayout>
<LinearLayout
android:id="@+id/widget53"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" >
<Button ../>
<EditText .. />
</LinearLayout>
</RelativeLayout>
//Write item on the screen
lv = (ListView)findViewById(R.id.items);
lv.setAdapter(indexadapter.getAdapter());
lv.setTextFilterEnabled(true);
lv.setOnItemClickListener(ItemClick);
//My list Adapter generate rows base on mData from database
CategoryHolder CategoryHolder = null;
if (convertView == null) {
//getting view format
CategoryHolder = new CategoryHolder();
convertView = mInflater.inflate(R.layout.categoryshow, null);
CategoryHolder.category=(TextView)convertView.findViewById(R.id.indexcategory);
//setting tag for reuse;
convertView.setTag(CategoryHolder);
//setting text for each item;
CategoryHolder.category.setText((String)mData.get(position).get("CATEGORY"));
}else{
CategoryHolder = (CategoryHolder)convertView.getTag();
}
in your AndroidManifest.xml file, in your <activity…> definition, include
android:windowSoftInputMode="adjustPan"like so: