在我的应用程序中,我使用ViewPager来实现漂亮的滑动视图。我希望在其中两个页面上隐藏键盘,但始终在一个页面上显示键盘,因为我有一个文本框。
我尝试过各种方法来让键盘显示,但它就是不起作用。我想我一定是在错误的位置调用了显示键盘的代码。
任何帮助都将是非常棒的,因为它让我发疯了!
我尝试过各种方法来让键盘显示,但它就是不起作用。我想我一定是在错误的位置调用了显示键盘的代码。
@Override
public Object instantiateItem( View collection, int position )
{
LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = null;
if(position==0){
layout=inflater.inflate(R.layout.other, null);
//new PC().create(layout, context);
((InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(collection.getWindowToken(), 0);
}else if(position==1){
layout=inflater.inflate(R.layout.main, null);
new BlurayRemote().create(layout,context);
((InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(collection.getWindowToken(), 0);
}else if(position==2){
layout=inflater.inflate(R.layout.text, null);
new TextInput().create(layout,context);
((InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInputFromInputMethod(collection.getWindowToken(), 0);
}
((ViewPager) collection).addView(layout);
return layout;
}
任何帮助都将是非常棒的,因为它让我发疯了!