xamarin.forms 从 android 中的文件为页面设置背景图像 [英] xamarin.forms set backgroundimage for page from file in android

查看:35
本文介绍了xamarin.forms 从 android 中的文件为页面设置背景图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在运行时创建的图像文件.

I have an Image file that i create during runtime.

我想将其设置为 ContentPage 的 backgroundImage(在 android 项目中)

I want to set it as backgroundImage of a ContentPage (in android project)

我试图将文件的路径设置为 BackgroundImage 属性,但它不起作用.

I tried to set the path of the file to the BackgroundImage property but it doesn't work.

有办法吗?

我不能把它作为资源,因为我是在运行时创建的

I can't put it as resource since I create it at runtime

推荐答案

我认为文档已经过时.因为目标 Android 有不止一种资源.作为/drawable-hdpi/drawable-xhdpi等

I think that documentation is out of date. Becuase target Android has more than one resources. as /drawable-hdpi /drawable-xhdpi etc.

所以你应该为所有文件夹添加你的图像,因为它可以工作设备.它有效.

So you should add your images for all folders because it will work device. It Works.

*但我认为 Xamarin.Forms 上的主要问题因为当系统找不到特殊分辨率时,可绘制文件夹必须使用默认图像源必须从默认文件夹中选择... *

*but I think that main issue on Xamarin.Forms Becase drawable folder have to default images source when system couldn't find special resolution must select from default folder... *

这篇关于xamarin.forms 从 android 中的文件为页面设置背景图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆