Is there anyway to create an input text that opens the device target's native keyboard ? (from the bottom screen of iOS and Android devices).
I tried
tripleplay.ui.Field field = new Field();
But it only shows a pop up with a native text field.
Thank you
There's an experimental new API in TriplePlay called NativeTextField
that can be used to overlay a platform-native text field with the right position and dimensions so that it appears to be part of your TriplePlay UI. When the user taps it to give it focus, the OS keyboard is shown and text entry works as it does normally in a native app.
There is currently only an implementation for iOS, but an Android implementation will eventually be aded.
Include the tripleplay-ios.jar in your ios/pom.xml
like so:
<dependency>
<groupId>com.threerings</groupId>
<artifactId>tripleplay-ios</artifactId>
<version>${playn.version}</version>
</dependency>
and then add a call to your Main.cs
file:
IOSTPPlatform.register(platform);
where platform
is the IOSPlatform
returned by IOSPlatform.register
.
With all of that wired up, then Field
will automatically use the native text field implementation on iOS.
One other thing to note: the native text field just shows the native text field while text is being edited. When text editing is done, the native field is removed and the standard TriplePlay Field is used to display the current value of the text.
If this results in weird shifting of the text because the rendering is slightly different, you can leave the native text field in place all of the time with the Field.FULLTIME_NATIVE_FIELD
style.