问题
I developed a simple javafx application to be ported in Android Environment, however I cant type any characters in the TextField. I guess its a bug, how to fix this one?
Th problem on galaxy S5 android 5.0.1 is not present but on galaxy tab 4 android 5.0.2 it doesn't work i type but none is displyed. Tried with normal textfield. And the problem persist also I have added the properties . Another strange rhig is that the space where recognizer. And the del button . The text not
THe code by example is very easy
Rectangle2D visualBounds = Screen.getPrimary().getVisualBounds();
double width = visualBounds.getWidth();
double height = visualBounds.getHeight();
TextField tt= new TextField();
tt.setTranslateY(-150);
StackPane stackPane = new StackPane();
stackPane.getChildren().addAll(tt);
borderpane.setCenter(stackPane);
Scene scene = new Scene(borderpane, width, height);
stage.setScene(scene);
回答1:
Assuming that CustomTextField
is just a custom TextField
, this is a known issue, not related to the CustomTextField
itself, given that it works in other device.
If you debug it:
./adb logcat -v threadtime
you surely find an exception that explains the issue: a StackOverFlow
exception.
On older devices it can be solved adding this: create a java.custom.properties
file, and include in it this property:
monocle.stackSize=128000
You may also include this one:
monocle.platform=Android
(it will be soon included by default in the next version)
Put the file at the root of your classpath, e.g. in the folder src/android/resources
of your project.
Build and deploy the project on your mobile and check again.
来源:https://stackoverflow.com/questions/36316573/javafxports-textfield-issue-android-keyboard-wont-function