1 回答

TA貢獻(xiàn)1834條經(jīng)驗(yàn) 獲得超8個(gè)贊
您可以使用以下 CSS 規(guī)則更改 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 規(guī)則是不言自明的,您可以輕松進(jìn)行更改。我使用 #D7D6DC 顏色作為邊框顏色來(lái)匹配圖像中的顏色, -fx-background-insets 也是 modenas.css 中使用的默認(rèn)值
結(jié)果 :
PS 我看不到圖像中的邊框(左和右)是否存在,以防您只想顯示上下邊框,您也可以通過(guò)-fx-border-width : 1 0 1 0;
. 除了字體大小和系列,您還可以使用-fx-font-size
和-fx-font-family
。iOS 使用的字體是San Francisco。
添加回答
舉報(bào)