This is only half-an-answer, because I am in the middle of a project and haven't been game to update my B4A to the B4XLIB level, but... it used to work, and I would expect that the XUI library would be similarly capable.
(with the proviso that: when you say "set the keyboard upon display", presumably you mean display of the field, not display of the keyboard... changing the keyboard after it is displayed sounds like a much more ambitious affair ;-)
Dim InputField As EditText
InputField.Text = VariableContainingExistingFieldData
If IsNumber(InputField.Text) Then
InputField.InputType = InputField.INPUT_TYPE_DECIMAL_NUMBERS
InputField.InputType = InputField.INPUT_TYPE_TEXT