我有一个与我的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