黑屏JavaFX Gluon应用程序

时间:2016-11-01 23:13:06

标签: java android javafx gluon javafxports

我知道以前曾经问过但我无法克服这个问题...我制作了一个应用程序,它在桌面上运行完美,可以顺利构建apk ...但是当我将它安装在我的设备(索尼Xperia M2 aqua),它只显示一个黑屏...任何帮助将是apreciated ...

摇篮:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'org.javafxports:jfxmobile-plugin:1.0.0-b10'
    }
}

apply plugin: 'org.javafxports.jfxmobile'

repositories {
    jcenter()
}

mainClassName = 'com.paneladebarro.PanelaDeBarroFx'

jfxmobile {
    android {
        manifest = 'src/android/AndroidManifest.xml'
    }
}

MainUi.java

package com.paneladebarro;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Rectangle2D;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.StackPane;
import javafx.stage.Screen;
import javafx.stage.Stage;

public class PanelaDeBarroFx extends Application {

    @Override
    public void start(Stage stage) {
        try {
            StackPane root = FXMLLoader.load(PanelaDeBarroFx.class.getResource("/MainUI.fxml"));

            Rectangle2D visualBounds = Screen.getPrimary().getVisualBounds();
            Scene scene = new Scene(root, 563, 900);
            scene.getStylesheets().add(getClass().getResource("/style.css").toExternalForm());

            stage.getIcons().add(new Image(PanelaDeBarroFx.class.getResourceAsStream("/icon.png")));
            stage.setScene(scene);
            stage.show();

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

0 个答案:

没有答案