I have a ListActivity that has list item with EditText in them.
When there is many items on the list (say ~25) and only 7 is visible at a given time. When I tap on one item, I want the keyboard to show "Next" and scroll through 1 - 25. But what ends up happening is, I will get "Next" until 6th item and I get "Done" on the 7th Item. So, essentially just shows that on Visible rows only. Note: I get "Next" automatically without setting imeoption, if I were to set "inputType" on the editText (may be its a bug or a feature :))
Here is what I have done in the AndroidManifest.xml, so the view adjusts to show the cursor and auto scroll the list.
<activity
...
android:windowSoftInputMode="adjustUnspecified|adjustPan">
In the Activity onCreate I set Focusable to false so that editText gets focus instead of listview itself.
ListView listView = getListView();
listView.setFocusable(false);
In the adapter class I set inputType of editText. Doing this gives me "Next" instead of "Enter".
EditText editText = (EditText) view.findViewById(R.id.data_text);
editText.setText(getItem(position));
editText.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
I have searched through "SO" and google, I have not yet found any leads.
EDIT: Here is my adapter class
class ItemAdapter extends ArrayAdapter<String> {
public ItemAdapter(Context context, int resource) {
super(context, resource);
}
@Override
public View getView(final int position, View convertView, final ViewGroup parent) {
View view = convertView;
if (view == null) {
LayoutInflater layoutInflater = (LayoutInflater) getContext().getSystemService(LAYOUT_INFLATER_SERVICE);
view = layoutInflater.inflate(R.layout.list_item, parent, false);
}
final EditText editText = (EditText) view.findViewById(R.id.input_text );
String data = getItem(position);
editText.setText(data);
editText.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
return view;
}
}