image do not show in .net android?

mc 3,906 Reputation points
2024-05-19T15:06:04.2166667+00:00

I add ImageView in activity_main.xml and set the src

android:src="@mipmap/tab_index"

but it is not show.

just white .

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,066 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 70,811 Reputation points Microsoft Vendor
    2024-05-20T01:43:55.5+00:00

    Hello,

    If you want to set a picture to the ImageView, please create drawable folder in Resources folder. Then copy your picture to this drawable folder and make sure this build action of picture is AndroidResource.

    In the end, change your ImageView src like following code.

    <ImageView
         android:contentDescription="this tab index"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:src="@drawable/tab_index"/>
    

    By the way, mipmap A folder used to store image resources, mainly for application icons.

    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.


0 additional answers

Sort by: Most helpful