How to add Next button in Ionic soft keyboard plugin
We are developing the android application using the Ionic framework.
When we click on the input text box we need to show next button instead of the return button. In the native Android API, we have options to show the next button. But in the Ionic frame work we don't have options to show the next button.
How can I add the next button in the soft keyboard when input text box field is selected?
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false);//show the keyboard accessory bar with the next, previous and done buttons
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);//hide the keyboard accessory bar with the next, previous and done buttons
参考ionic-plugin-keyboard文件,这些功能只支持ios平台,所以它们对android没有任何影响。
Next button won't appear because by default, ionic projects hide it.If need to show next button,Use below line inside device ready event.
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
The complete code is,
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
//Comment out this line if you want the next and previous buttons
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
// Set the statusbar to use the default style, tweak this to
// remove the status bar on iOS or change it to use white instead of dark colors.
StatusBar.styleDefault();
}
});
})
正确的答案是传递false
,而不是true
:
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false);
链接地址: http://www.djcxy.com/p/87584.html
上一篇: “特征未注册”错误
下一篇: 如何在离子软键盘插件中添加下一步按钮