我有一個與我的javafx移植的應用程序在Android上的問題。 第一次發射後,它看起來像這樣:Android上的奇怪的javafx應用程序看看
但是當我去到主屏幕,然後重新加入到應用程序,它看起來也應該如此。
的build.gradle:
buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.1.1'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
mavenCentral()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
mainClassName = 'pl.siemaeniu500.wszywka.main.Main'
ext.CHARM_DOWN_VERSION = "2.0.1"
dependencies {
compile "com.gluonhq:charm-down-common:2.0.1"
//compile 'com.gluonhq:charm-glisten:3.0.0'
compile 'com.gluonhq:charm:2.1.1'
compile files('D:/Android/Sdk/platforms/android-21/android.jar', 'C:/Users/Kamil/Documents/NetBeansProjects/WszywkaSounds/jfxdvk-8.60.8.jar')
androidRuntime 'com.gluonhq:charm-android:2.1.1'
iosRuntime 'com.gluonhq:charm-ios:2.1.1'
desktopRuntime 'com.gluonhq:charm-desktop:2.1.1'
desktopCompile 'com.github.sarxos:webcam-capture:0.3.10'
}
jfxmobile {
downConfig {
version = '3.0.0'
plugins 'display', 'lifecycle', 'statusbar', 'storage'
}
android {
manifest = 'src/android/AndroidManifest.xml'
//compileSdkVersion 24
//buildToolsVersion "24.0.3"
androidSdk = 'D:/Android/Sdk'
}
ios {
infoPList = file('src/ios/Default-Info.plist')
forceLinkClasses = [
'com.gluonhq.**.*',
'javax.annotations.**.*',
'javax.inject.**.*',
'javax.json.**.*',
'org.glassfish.json.**.*'
]
}
}
主應用程序類:
package pl.siemaeniu500.wszywka.main;
import javafx.application.Application;
import static javafx.application.Application.launch;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Rectangle2D;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Screen;
import javafx.stage.Stage;
/**
*
* @author Kamil
*/
public class Main extends Application {
@Override
public void start(Stage stage) throws Exception {
Rectangle2D visualBounds = Screen.getPrimary().getVisualBounds();
Parent root = FXMLLoader.load(getClass().getResource("FXML.fxml"));
Scene scene = new Scene(root, visualBounds.getWidth(), visualBounds.getHeight());
stage.setScene(scene);
stage.setMaximized(true);
//new FXMLController().initialize();
stage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
什麼原因呢?
沒有你的代碼,我們怎麼能告訴?至少發佈你的'build.gradle'腳本,至少你是如何在Application類上創建場景/舞臺的。 –
你的構建需要一些清理......絕大多數的依賴不是必需的。基本上你只需要最後一個。除此之外,你可以刪除'stage.setMaximized(true);'然後再試一次嗎? –
是的,它幫助,謝謝:) – siemaeniu500