mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-04-25 10:56:35 +08:00
Fix Android Demo Issues (#767)
* fix: fix android demo issues. * feat: enable CoreCLR usage on Android.
This commit is contained in:
20
demo/Semi.Avalonia.Demo.Android/Application.cs
Normal file
20
demo/Semi.Avalonia.Demo.Android/Application.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using Android.App;
|
||||||
|
using Android.Runtime;
|
||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Android;
|
||||||
|
|
||||||
|
namespace Semi.Avalonia.Demo.Android;
|
||||||
|
|
||||||
|
[Application]
|
||||||
|
public class Application : AvaloniaAndroidApplication<App>
|
||||||
|
{
|
||||||
|
protected Application(nint javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
|
||||||
|
{
|
||||||
|
return base.CustomizeAppBuilder(builder)
|
||||||
|
.WithSourceHanSansCNFont();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
using Android.App;
|
using Android.App;
|
||||||
using Android.Content.PM;
|
using Android.Content.PM;
|
||||||
using Avalonia;
|
|
||||||
using Avalonia.Android;
|
using Avalonia.Android;
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.Android;
|
namespace Semi.Avalonia.Demo.Android;
|
||||||
@@ -12,11 +11,4 @@ namespace Semi.Avalonia.Demo.Android;
|
|||||||
MainLauncher = true,
|
MainLauncher = true,
|
||||||
LaunchMode = LaunchMode.SingleTop,
|
LaunchMode = LaunchMode.SingleTop,
|
||||||
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)]
|
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)]
|
||||||
public class MainActivity : AvaloniaMainActivity
|
public class MainActivity : AvaloniaMainActivity;
|
||||||
{
|
|
||||||
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
|
|
||||||
{
|
|
||||||
return base.CustomizeAppBuilder(builder)
|
|
||||||
.WithSourceHanSansCNFont();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net10.0-android</TargetFramework>
|
<TargetFramework>net10.0-android</TargetFramework>
|
||||||
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion>23</SupportedOSPlatformVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ApplicationId>com.irihitech.Semi.Avalonia</ApplicationId>
|
<ApplicationId>com.irihitech.Semi.Avalonia</ApplicationId>
|
||||||
<ApplicationVersion>1</ApplicationVersion>
|
<ApplicationVersion>1</ApplicationVersion>
|
||||||
@@ -13,6 +13,12 @@
|
|||||||
<RootNamespace>Semi.Avalonia.Demo.Android</RootNamespace>
|
<RootNamespace>Semi.Avalonia.Demo.Android</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- Use CoreCLR on Android -->
|
||||||
|
<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
|
||||||
|
<UseMonoRuntime>false</UseMonoRuntime>
|
||||||
|
<PublishReadyToRun>true</PublishReadyToRun>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AndroidResource Include="Icon.png" Link="Resources\drawable\Icon.png"/>
|
<AndroidResource Include="Icon.png" Link="Resources\drawable\Icon.png"/>
|
||||||
<AvaloniaResource Include="..\Fonts\*" Link="Assets\Fonts\%(Filename)%(Extension)" />
|
<AvaloniaResource Include="..\Fonts\*" Link="Assets\Fonts\%(Filename)%(Extension)" />
|
||||||
|
|||||||
Reference in New Issue
Block a user