Reputation: 1
I've built a simple login screen for a Gluon Mobile application. I can set the color of the TextField's text successfully, but whenever I tap on another TextField, the previous TextField's text turns black, no matter what Theme I assign.
I've tried the following mechanisms to try to control the text color, but none of them prevented the black text from returning when tapping on another TextField:
.charm-text-field
, .text-field
, .charm-text-field > text-field
, etc.):hover
, :focused
, etc.)I've used both the TextField provided by Gluon's libraries and the default TextField from JavaFX.
Changing the color of the TextField's text while typing hasn't been a problem at all, but no matter what I do, when I tap on the next TextField, the other TextField's text turns black. It doesn't happen on the desktop implementation, only on the Android application; I've tried running it on multiple devices all with the same outcome.
Does anyone know why that happens or how to resolve it? It doesn't appear to be subject to JavaFX CSS rules and I can't find any additional style influence in Scenic View, but the problem also doesn't occur on desktop at all.
I was able to implement a workaround to fix this issue like so:
usernameField.textProperty().addListener(change -> {
usernameField.setStyle("-fx-text-fill: #c3c3c3");
});
This reapplies the style whenever the text property changes, which is heavy handed. The style doesn't change on desktop at all with the following FX CSS:
.charm-text-field,
.text-field,
.charm-text-field > .text-field,
.text,
.text-field > .text,
.charm-text-field > .text-field > .text {
-fx-text-fill: #c3c3c3;
}
If I can figure out what's causing the text property to change, maybe I can find a real solution.
Upvotes: 0
Views: 36