0

我正在尝试为要点击的区域创建图像映射。它现在是一个演示,我没有时间构建所有的原生部分。

现在我将 a 覆盖StackLayoutImage. GridLayout` 但点击事件StackLayout tap. I tried a suggestion to put into a仍然不起作用。浅灰色背景出现在我想要的区域上。

<GridLayout rows="*"
            columns="*">
  <StackLayout row="0"
                col="0"
                width="262"
                height="36"
                marginLeft="30"
                marginTop="147"
                backgroundColor="lightgray"
                style="z-index: 2"
                (tap)="onTap()">
  </StackLayout>
  <Image row="0"
            col="0"
            src="~/images/map.svg"
            width="100%"
            height="255"
            style="z-index: 1"></Image>
</GridLayout>
4

1 回答 1

2

改变元素的位置可以修复它。

<GridLayout rows="*"
            columns="*">
  <Image row="0"
            col="0"
            src="~/images/map.svg"
            width="100%"
            height="255"
            style="z-index: 1"></Image>
  <StackLayout row="0"
                col="0"
                width="262"
                height="36"
                marginLeft="30"
                marginTop="147"
                backgroundColor="lightgray"
                style="z-index: 2"
                (tap)="onTap()">
  </StackLayout>
</GridLayout>
于 2018-12-12T03:33:03.417 回答