您可以使用以下CSS规则更改TextField外观以匹配iOS:
#ios-field {
-fx-background-color: white;
-fx-border-color : #D7D6DC;
-fx-background-insets: -0.2, 1, -1.4, 3;
-fx-background-radius: 0;
-fx-padding: 4 7 4 15 ;
-fx-prompt-text-fill: derive(-fx-control-inner-background,-30%);
}
#ios-field:focused {
-fx-border-color : #D7D6DC;
-fx-background-color: white;
-fx-background-insets: -0.2, 1, -1.4, 3;
-fx-background-radius: 0;
-fx-padding: 4 7 4 15 ;
}
我相信CSS规则是不言自明的,你很容易做出改变。我使用#D7D6DC颜色作为边框颜色来匹配图像中的颜色,-fx-background-insets是modenas.css中使用的默认值
结果:
P.S我无法看到图像中的边框(左和右)是否存在,以防您只想显示上边框和下边框,您也可以通过-fx-border-width : 1 0 1 0;
显示。除了字体大小和系列,您还可以使用-fx-font-size
和-fx-font-family
。用于iOS的字体是San Francisco。