How to use android xml layouts and other xml resources in MAUI?

Satya 160 Reputation points
2023-02-28T09:31:26.34+00:00

How to use android xml layouts in activity/custom renderers/Maui handlers and other xml resources in MAUI?

I didn't found anything in MAUI documentation. Please help me out

Thanks in advance

Developer technologies | .NET | .NET MAUI
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2023-03-01T05:38:07.0066667+00:00

    Hello,

    You can use it directly,

    For example, if I create a xml file in the Resources\drawable\, I can use it in the handler directly, you can use layout or other xml resources as well.

     Microsoft.Maui.Handlers.FlyoutViewHandler.Mapper.AppendToMapping("MyCustomization", (handler, view) =>
            {
    #if ANDROID
                handler.PlatformView.SetBackgroundResource(Resource.Drawable.expand_collapse);
    #endif
            });
    

    Best Regards,

    Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.