Search code examples
androidxamarinxamarin.android

Android - drawable-dpi images are not picking up


I'm new to Android. I have an image in different size and copied to respective drawable-dpi folders. If I don't have the same image in the drawable folder, it's not getting displayed in the view. If I add the image in drawable folder, its getting displayed but not picking up based on the phone's resolution.


Solution

  • Place images in the Resources/drawable directory with Build Action: AndroidResource. High- and low-DPI versions of an image can also be supplied (in appropriately named Resources subdirectories such as drawable-ldpi, drawable-hdpi, and drawable-xhdpi).

    enter image description here

    For mode code, you could download the source file from the GitHub for reference. https://github.com/xamarin/xamarin-forms-samples/tree/main/WorkingWithImages