- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是 XAML 和 Xamarin 表单的新手。
我正在寻找一种设计 UI 的方法,其中透明按钮放置在背景图像上,这将用作 Remote (按钮将放置在下面屏幕截图中的图标上):
我试图改变 Xamarin's GridDemoPage为了这。我有一个 3*3 的网格。这是我到目前为止能够做的:
这是我的代码:
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="iRemote.RemotePage"
Title="REMOTE"
BackgroundImage="light.png"
BackgroundColor="Transparent">
<RelativeLayout VerticalOptions="Center" HorizontalOptions="Center">
<Grid VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand" WidthRequest="330" HeightRequest="330" Padding="0,0,0,0">
<Button x:Name="Btn1" Text=""
Grid.Row="0" Grid.Column="0" Clicked="OnClickCommand" BackgroundColor="Aqua"/>
<Button x:Name="Btn2" Text=""
Grid.Row="0" Grid.Column="1" Clicked="OnClickCommand" BackgroundColor="White"/>
<Button x:Name="Btn3" Text=""
Grid.Row="0" Grid.Column="2" Clicked="OnClickCommand" BackgroundColor="Red"/>
<Button x:Name="Btn4" Text=""
Grid.Row="1" Grid.Column="0" Clicked="OnClickCommand" BackgroundColor="Blue"/>
<Button x:Name="CenterButton" Text=""
Grid.Row="1" Grid.Column="1" Clicked="OnClickSend" BackgroundColor="Black"/>
<Button x:Name="Btn5" Text=""
Grid.Row="1" Grid.Column="2" Clicked="OnClickCommand" BackgroundColor="Green"/>
<Button x:Name="Btn6" Text=""
Grid.Row="2" Grid.Column="0" Clicked="OnClickCommand" BackgroundColor="Yellow"/>
<Button x:Name="Btn7" Text=""
Grid.Row="2" Grid.Column="1" Clicked="OnClickCommand" BackgroundColor="Maroon"/>
<Button x:Name="Btn8" Text=""
Grid.Row="2" Grid.Column="2" Clicked="OnClickCommand" BackgroundColor="Lime"/>
</Grid>
<Image x:Name="RemoteCenterImage" Source="r_720_inactive.png"/>
</RelativeLayout>
</ContentPage>
很明显,我还没有走得太远。我正在考虑将按钮包含在 absoluteLayout 中并放置/调整它们的大小以适合图标。
但是,我面临着多个问题。我已经对网格的高度和宽度进行了硬编码,因此这段代码不是自适应屏幕大小的。
我使用网格来完成此任务的方法可行吗?或者有更好的方法吗?
如何更改 XAML 以使 UI 具有响应性?
我应该如何以响应式方式在网格中定位/放置按钮?
最佳答案
试试这个:
<AbsoluteLayout>
<Image x:Name="backgroundImage" Source="yourBackround.png" AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Aspect="AspectFill"/>
<Grid>
<Button Grid.Row="0" Grid.Column="0" Clicked="OnClickCommand" BackgroundColor="Aqua"/>
....
<!-- Grid automatically creates rows and columns with "*" size when you put a child with Grid.Row and/or Grid.Column -->
</Grid>
</AbsoluteLayout>
请记住,您可能需要固定 AbsoluteLayout 的大小或 W/H 比率以保持图像和网格同步,可能通过处理其 SizeChanged 事件或父元素约束,或绑定(bind)其中一个或两个 W/H 属性
关于c# - Xamarin XAML : Placing a Grid over an Image (responsive to screen size),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28012575/
我在 * nix 中相当新。有没有办法创建一个屏幕,它会立即执行给定的命令序列(带有自己的参数)?两个小时的谷歌搜索一无所获——也许是因为我不能 清楚地陈述问题。 我希望像 screen -dmS n
我顺风顺风margin配置文件中的属性: module.exports = { theme: { extend: { 'margin': {
我正在 cygwin 环境中配置 GNU 屏幕。实际上重新配置——它之前总是有效,当我升级到 cygwin-64 时,相同的配置文件给了我意想不到的行为。 发生的情况是,每当我在终端中执行溢出全屏的操
关闭。这个问题是off-topic .它目前不接受答案。 想改善这个问题吗? Update the question所以它是 on-topic对于堆栈溢出。 10年前关闭。 Improve this
我想使用 GNU screen 来监视这样的串行 USB 端口: $ screen /dev/ttyUSB0 115200 但我需要调整一些终端线路设置。我已经进行了几次尝试,但似乎都没有奏效。例如,
我需要在我的 .screenrc 中放入什么才能创建嵌套 session (即:屏幕中的屏幕)? 目前,如果我运行 screen再次从打开的屏幕选项卡中,而不是在该选项卡中打开一个新的屏幕 sessi
我通常像这样使用 gnu 屏幕: 1. 为我的所有任务启动一个屏幕 session 2.当我登录到一台机器时,我连接到我同事制作的屏幕 session (screen -x)(因此这使它成为“内部屏幕
使用屏幕,我知道我可以按名称命名和重新附加到 session : screen -S screen -r 当我执行 screen -ls我得到一个 session 列表,但
如何增加screen中可以查看的行数? 我想查看从运行screen -S 到当前操作的那几行。例如,如何将缓冲区长度增加到大约50000行? 我已经尝试过^a :scrollback ,但是它不会增加
很难说出这里问的是什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或言辞激烈,无法以目前的形式合理回答。如需帮助澄清此问题以便可以重新打开,visit the help center . 8年前关闭
作为设置桌面的启动脚本的一部分,我初始化了一个带有多个窗口的 screen 。为此,我启动一个守护进程并向其发送 -X screen 和 -X stuff 命令,最后使用 -r 重新连接。 不幸的是,
当我开始时 screen ,我收到以下消息: Screen version 4.00.03jw4 (FAU) 2-May-06 Copyright (c) 1993-2002 Juergen Weig
刚刚开始使用 Screen 与 Vim 进行远程配对编程。 想知道是否有办法调整窗口大小,因为我们的终端空间在默认设置下非常有限。 目前我正在进入这样的屏幕: User 1: screen -R te
所以我一直在尝试寻找一些关于 GNU screen 实际上如何在 high 下工作的信息,而不必真正阅读源代码,但我一直无法这样做。 screen 做了什么,即使在终端 session 关闭时它也能保
我有一个游戏服务器。它通过 dotnet 在 linux 上运行。我在“screen ” session 中运行它。但是我正在努力重新启动此服务器。从外面看,很容易。我只是通过名称杀死现有 scree
我想使用 mac/linux 命令 screen 启动多个 screen ,让每个 screen 执行我的 .bashrc,然后从该 .bashrc 运行一系列别名/函数。我尝试在我的 .screen
当我在终端工作时,我会看到最后一个 shell 命令执行输出的历史记录。如果我运行 vim,我会看到我全屏打开的文件。当我退出 vim 时,我可以再次看到最后一个 shell 命令的历史。 但是,当我
我正在写一个小脚本,它确实向正在运行的屏幕 session 发送命令。此命令会停止屏幕,但不会立即停止。我需要等待它完成才能继续执行脚本的其余部分。 这就是我停止屏幕的方式: screen -S $S
我们在办公室经常使用 gnu screen ,有时如果我不注意,我最终会迷失在我已经在哪个 screen session 中。 所以我的问题是,你怎么知道你在哪个屏幕 session 中?你有办法查吗
我想知道 Mozenda Screen Scraper 是如何编码的? http://www.mozenda.com/screen-scraper 我展示了一个浏览器,用户可以在其中选择他想要删除的字
我是一名优秀的程序员,十分优秀!