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
refer to ionic-plugin-keyboard document, these functions only support ios platform, so they have no effect on 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();
}
});
})
The right answer would be passing false
, instead of true
:
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false);