0
我有一個帶有樣式化AppBar的設置視圖,當我從該視圖打開全屏對話框時,AppBar樣式遵循指定的全局色板。 然後,當我關閉對話框時,設置視圖應用程序欄保留對話框樣式(它應該有一個白色背景,但它是綠色的,這是爲應用程序指定的色板)。Gluon Mobile對話框應用程序自定義
進一步明確:
觀是設置的頁面,然後單擊每個設置彈出對話框與內容設置爲包含該特定設置的信息StackPanes。
我曾試圖添加風格化的對話框關閉AppBar,隱藏的方法,和隱藏的事件處理程序:
public void initView(SettingView viewType) {
View pane = null;
try {
switch (viewType) {
case PASSWORD_CHANGE:
pane = getPasswordPane();
break;
case PROFILE_CHANGE:
pane = getProfilePane();
break;
case BANK_CHANGE:
pane = getBankPane();
break;
case NOTIFICATION_CHANGE:
pane = getNotificationPane();
break;
}
} catch (IOException e) {
System.out.println("IOException: " + e);
}
//this.settingsContainer = new Dialog(true);
this.settingsContainer.setContent(pane);
MobileApplication.getInstance().removeLayerFactory("$$$DropdownButtonSkin$$$");
Platform.runLater(new Runnable() {
@Override
public void run() { //None of these change the appbar styling
settingsContainer.setOnShowing(e -> { setAppBar("Settings");});
settingsContainer.setOnShown(e -> { setAppBar("Settings");});
settingsContainer.setOnHiding(e -> { setAppBar("Settings");});
settingsContainer.setOnHidden(e -> { setAppBar("Settings");});
//When closing the appbar the color remains to the swatch instead of the customized background
settingsContainer.setOnCloseRequest(e -> { setAppBar("Settings");});
settingsContainer.showAndWait();
}
});
}
public AppBar setAppBar(String name) {
Button menu = MaterialDesignIcon.MENU.button();
menu.setStyle("-fx-text-fill:darkgreen;");
menu.setOnMouseClicked(e -> {
MobileApplication.getInstance().showLayer(Appstar.MENU_LAYER);
});
AppBar appBar = MobileApplication.getInstance().getAppBar();
appBar.clear();
appBar.setNavIcon(menu);
appBar.setTitleText(name);
appBar.setVisible(true);
appBar.setBackground(new Background(new BackgroundFill(Color.WHITE, new CornerRadii(0), new Insets(0, 0, 0, 0))));
return appBar;
}
你想在一個自定義AppBar(不同的顏色)的全屏的對話框視圖,你仍然可以看到AppBar上的對話框上的色板顏色,對嗎? – ItachiUchiha
我有一個設置視圖與appbar風格有白色背景。色板是綠色的。當我打開對話框時,對話框appbar是綠色的。當我關閉appbar時,Settings視圖的appbar也變爲綠色。只有當我通過導航菜單切換視圖時,設置背景纔會再次變爲白色。 –