Im new on android please help me to auto hide after scrolling the listview here is my code but could not get right solution
xml file :
<ListView
android:id="@+id/offline_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#dde1e3"
android:clickable="true"
android:focusable="true"
>
</ListView>
code:
lvCustomList.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
// TODO Auto-generated method stub
if(!hasFocus)
hideKeyboard(v);
}
private void hideKeyboard(View view) {
// TODO Auto-generated method stub
InputMethodManager inputMethodManger = (InputMethodManager)getSystemService(Activity
.INPUT_METHOD_SERVICE);
inputMethodManger.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
});
Try this one.
Hope it helps. Cheers!
Try this..
why don't you use
OnTouchListener
forListView
like belowIt is better to use
onScrollStateChanged
instead ofonScroll
and by usingscrollState == 0
. So keyboard will hide when user is really scrolling.