- Home /
Remove "Preview text line" above keyboard input text on Android and iPhone
An extra bar is loaded on top of the keyboard on iPhone or Android Devices. Is the a way to remove the extra line where the text is previewed on a mobile device or tablet?
When finished typing you have to press done on the keyboard to submit the text, this also hides the keyboard. If you don't press submit on the keyboard the application doesn't register anything has been typed.
I have a scene where a password needs to be submitted. Next to the password field is my submit button. If the password is typed in and my button pressed without the keyboard submit button being pressed first Unity doesn't register the password. I have to press submit on the keyboard first even though the password is in its text field. This is a double step and is confusing people.
Thanks in advance.
i am also struggling with this, have you come up with a solution?
Answer by mehowe7 · Jan 30, 2012 at 11:49 AM
var hit : RaycastHit;
var text : String; var textMesh : TextMesh; var backtextMesh : TextMesh; private var keyboard : iPhoneKeyboard;
function Update(){
if(Input.touches.length > 0){
if(Input.touches[0].phase == TouchPhase.Began){
if(Physics.Raycast(camera.ScreenPointToRay(Input.mousePosition), hit, 100)){
if(hit.collider.CompareTag("Numberplate")){
numberplateOn();
if(!iPhoneKeyboard.visible)keyboard = iPhoneKeyboard.Open(text,iPhoneKeyboardType.Default,false,false, false, true);
}
}
}
}
if(keyboard){
if (mainscript.numberplateType && keyboard.done){
mainscript.numberplateType = false;
numberplateOff();
}
}
this is what i am using. however you cannot use your own text box, you must use the one attached to the keyboard. pressing either the keyboard enter button or the done button calls my function fine which is numberplateOff but you can put your own function there.