1
使用javafx(使用javafxports &膠子移動)的Android應用程序開發新手。
我是否使用gluon-Api來擴展MobileApplication類來構建我的項目。
使用sample programs。他試圖製作我自己的版本。
但是,在開始的應用程序我開始這個不需要的對話。
我在談論這個對話框,保持出現在應用程序的啓動。
啓動時刪除膠子移動對話框
這裏是我的代碼。我已經擴展MobileApplication類來創建我自己的基於samples的應用程序版本。
package com.gluonapplication;
import com.gluonapplication.views.Home;
import com.gluonhq.charm.glisten.application.MobileApplication;
import static com.gluonhq.charm.glisten.application.MobileApplication.HOME_VIEW;
/**
*
* @author Guru
*/
public class MainApplication extends MobileApplication {
public void init()
{
addViewFactory(HOME_VIEW,() -> new Home(HOME_VIEW).getView());
}
public void postinit()
{
}
public void start()
{
}
}
這裏是返回應用程序的主視圖的Home類。
package com.gluonapplication.views;
import com.gluonhq.charm.glisten.mvc.View;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.fxml.FXMLLoader;
/**
*
* @author Guru
*/
public class Home {
View view;
String name;
public Home(String name)
{
this.name=name;
}
public View getView()
{
try
{
view=FXMLLoader.load(Home.class.getResource("HomeView.fxml"));
view.setName(name);
}
catch (IOException ex)
{
Logger.getLogger(Home.class.getName()).log(Level.SEVERE, null, ex);
ex.printStackTrace();
return new View(name);
}
return view;
}
}
這裏的HomeView.fxml文件,其根是查看。
<?xml version="1.0" encoding="UTF-8"?>
<?import com.gluonhq.charm.glisten.mvc.View?>
<?import com.jfoenix.controls.JFXButton?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.VBox?>
<View prefHeight="600.0" prefWidth="350.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1">
<center>
< VBox alignment="CENTER" prefHeight="200.0" prefWidth="100.0" spacing="15" BorderPane.alignment="CENTER">
<children>
<Label text="Welcome Back!" />
<AnchorPane prefHeight="254.0" prefWidth="253.0">
<children>
<ImageView fitHeight="254.0" fitWidth="234.0" layoutX="56.0" pickOnBounds="true" preserveRatio="true">
</ImageView>
</children>
</AnchorPane>
<JFXButton text="Continue" />
</children>
</VBox>
由於提前,請幫我阻止出現這個對話框!
所以看來,我必須先申請許可證,並將其包含在我的項目中! –