Created
May 25, 2012 09:42
-
-
Save alvinsj/2786995 to your computer and use it in GitHub Desktop.
ActionBarSherlock ActionView EditText bugfix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
searchActionItem.setOnActionExpandListener(new | |
OnActionExpandListener() { | |
public boolean onMenuItemActionExpand(MenuItem item) { | |
searchText.post(new Runnable() { | |
public void run() { | |
searchText.requestFocusFromTouch(); | |
InputMethodManager imm = | |
(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); | |
imm.showSoftInput(searchText, 0); | |
} | |
}); | |
return true; | |
} | |
public boolean onMenuItemActionCollapse(MenuItem item) { | |
InputMethodManager imm = | |
(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); | |
imm.hideSoftInputFromWindow(searchText.getWindowToken(), 0); | |
searchText.post(new Runnable() { | |
public void run() { | |
searchText.clearFocus(); | |
} | |
}); | |
return true; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment