简体   繁体   中英

MAUI (Android) SurfaceView

I need a Android.Views.SurfaceView component to draw on.
I placed a Microsoft.Maui.Controls.BoxView component then tried to reach it's platform object using
var platformHandler = compname.Handler.PlatformView; but I receive Android.Views.View which doesn't have/relate a Android.Views.Surface object like I need.

Is there any component with a SurfaceView or Surface 'related' object I can use?
Maybe a way to extract a Surface object from the Android.Views.View ?

Since .NET MAUI is a cross-platform framework for creating native mobile and desktop apps with C# and XAML, you can try to use Microsoft.Maui.Graphics to achieve this.

.NET Multi-platform App UI (.NET MAUI) graphics, in the Microsoft.Maui.Graphics namespace, enables you to draw graphical objects on a canvas that's defined as an ICanvas object.

The .NET MAUI GraphicsView control provides access to an ICanvas object, on which properties can be set and methods invoked to draw graphical objects. For more information about the GraphicsView , see GraphicsView .

For more information, please check: Draw graphical objects .

Besides, .NET MAUI graphics includes the ability to paint graphical objects with solid colors, gradients, repeating images, and patterns. The Paint class is an abstract class that paints an object with its output. Classes that derive from Paint describe different ways of painting an object.

For more information, please check: Paint graphical objects .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM