我想用最少的动画(如旋转图像)创建一个启动屏幕。从此处找到的文档中,我认为可以使用“创建自定义 SplashScreen”部分中提到的方法来这样做。但我不知道从哪里开始。我首先使用创建了一个颤振 java 项目
flutter create -a java custom_splash
Run Code Online (Sandbox Code Playgroud)
然后我尝试复制粘贴文件内文档链接中给出的代码MainActivity.java并运行该应用程序,但该应用程序根本无法构建。我也尝试在内部使用旋转可绘制对象,launch_background.xml尽管它确实将图像旋转到特定角度,但它是静态的而不是动画的。
注意:我没有构建任何原生 android 应用程序,java 对我来说也是新的
编辑 1:
我想我必须将它显示为视图而不是可绘制对象。所以我尝试了这个。创建了一个名为SplashScreenWithTransition.javanext的文件MainActivity.java
package com.example.native_splash;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.example.native_splash.mySplashView;
import io.flutter.embedding.android.SplashScreen;
public class SplashScreenWithTransition implements SplashScreen {
@Override
@Nullable
public View createSplashView(
@NonNull Context context,
@Nullable Bundle savedInstanceState
) {
return new mySplashView(context);
}
@Override
public void transitionToFlutter(@NonNull Runnable onTransitionComplete) {
onTransitionComplete.run();
}
}
Run Code Online (Sandbox Code Playgroud)
和另一个名为 mySplashView.java …
我正在尝试在 flutter 桌面应用程序中调用 ac# dll 中的函数,
在我的 C# dll 中,
using System;
using System.Runtime.InteropServices;
namespace MathLibrary
{
// NOTE: I have set set [assembly: ComVisible(true)] in AssemblyInfo.cs
[ComVisible(true)]
[Guid("66DE2FB9-7A3B-4C33-AF26-9AD5EDD4C71F")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface IMathLibrary
{
[DispId(1)]
string multiply(int a, int b);
};
[ComVisible(true)]
[Guid("021E950E-3612-4FAD-9F15-F61632A95BD8")]
[ClassInterface(ClassInterfaceType.None)]
[ProgId("MathLibrary.MathCalc")]
public class MathCalc : IMathLibrary
{
public string multiply(int a, int b)
{
return "Product is " + (a * b).ToString();
}
}
}
Run Code Online (Sandbox Code Playgroud)
我使用这个存储库作为基础 flutter 应用程序。
在应用程序中,我使用平台通道在 dart 和 C++ 代码之间进行通信。在 C++ …