简体   繁体   English

将本地图片导入XML以用于跨平台应用程序

[英]Import Local Picture to XML for Cross-Platform App

I am currently working on a NativeScript App. 我目前正在使用NativeScript应用程序。 I am having trouble using a locally saved picture on this app. 我在此应用上使用本地保存的图片时遇到问题。 I need to be able to maximize this said picture in XML and make it transparent so it allows movement to the next page. 我需要能够以XML最大化上述图片并使其透明,以便允许移至下一页。

Depends on how you are storing your image; 取决于您存储图像的方式; if it is in the app folder then you need: 如果在应用程序文件夹中,则需要:

<Image src="/path/to/local/image">

If it is in the app_resources folder then you need 如果它在app_resources文件夹中,那么您需要

<Image src="res://image_name">

Add a width and a height to size it 添加宽度和高度以调整大小

<Image width="300" height="300">

Add some css for transparency: 添加一些CSS以提高透明度:

Image {opacity: 50;}

If you are needing a button (for navigation) above it then you should do: 如果您需要上方的按钮(用于导航),则应该执行以下操作:

<GridLayout rows="auto">
   <Image row="0" ... other params .../>
   <Button row="0" ... other params .../>
</GridLayout>

Grid layout will allow you to stack items in the same display area. 网格布局允许您将项目堆叠在同一显示区域中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM