Image Rendering in MAUI Webview for Android

Shelke, Siddhesh S 50 Reputation points
2023-04-16T16:42:47.46+00:00

The application is unable to render the images in Webview control for Android only. In iOS it works fine. Tried with all possible options I e. Relative & Absolute path but no luck

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,966 questions
{count} vote

Accepted answer
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 36,951 Reputation points Microsoft Vendor
    2023-04-17T05:48:46.2566667+00:00

    Hello,

    This issue occurs if you do not put the image under MAUI's assets folder or convert its properties to MauiAsset.

    The local HTML file can load Cascading Style Sheets (CSS), JavaScript, and images, if they've also been added to your app project with the MauiAsset build action. Quoted from WebView - Display a local HTML file.

    On my side, I add a test.png into Resources\Raw folder. After that, the Android WebView can display this image normally.

    Best Regards,

    Alec Liu.


    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.

    0 comments No comments

0 additional answers

Sort by: Most helpful