当用户点击AutoComplateTextView项目时,我试图隐藏软件键盘,但它不起作用。
这是我的代码:
mAutoCompleteTextView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
/**
* do something
*/
InputMethodManager inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromInputMethod(mAutoCompleteTextView.getWindowToken(), 0);
}
});
答案 0 :(得分:3)
将此代码放在onClick方法中:
For Each pvtitem In pt.PivotFields(6).PivotItems
On Error GoTo skipreason
itemValue = pt.GetPivotData("[Measures].[Cancelled]", "[Characteristics].[Reason]", pvtitem.Name).Value
If itemValue < 2000 Then
hiddenReasons(hiddenCount) = pvtitem.Name
hiddenCount = hiddenCount + 1
Else
visibleReasons(visibleCount) = pvtitem.Name
visibleCount = visibleCount + 1
End If
Sheets("Cancels").PivotTables("Cancels").PivotFields( _
"[Characteristics].[Reason].[Reason]" _
).VisibleItemsList = Array(visibleReasons())
答案 1 :(得分:0)
View view = this.getCurrentFocus();
if (view != null) {
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
将其放入点击事件