显示A"帮助"覆盖了一个Android布局布局、QUOT、Android

2023-09-04 04:00:31 作者:爱情,我戒了

我工作的一个游戏为Android(天空徒步旅行 - Google玩, Github上)。我想点添加一个帮助选项的游戏,它会去在游戏组件一个接一个,他们有一个箭头,并有一个文本框说,他们正在使用的东西。我在寻找什么是实现这一目标的最佳途径的建议。我应该显示一个巨大的(部分透明)的图像在其中包含箭头游戏活动(我所需要的每个箭头,游戏的每个组件的图像)。

I'm working on a game for the Android (Sky Hiking - Google Play, Github). I want to add a "help" option for the game where it'll go over the game components one by one, point to them with an arrow and have a text box say what they are used for. I'm looking for advice on what's the best way to achieve this. Should I display a huge (partly transparent) image over the game activity which contains the arrow (I will need an image for each arrow for each component of the game).

修改:还有这样不同的屏幕大小的问题

Edit: There's also an issue of doing this for different screen sizes.

什么是最好的做法就这一个?

What's the best practice on this one?

推荐答案

下面是我会做在这种情况下。它可能不是最好的解决方案,但它应该工作,而不管屏幕尺寸:

Here's what I would do in such a case. It may not be the best solution, but it should work, irrespective of the screen size:

不要在一个循环下,一次为每个元素:

Do the following in a loop, once for each element:

获取屏幕上的元素的当前位置。 在画的箭头的位置上紧挨着你的元素。可以通过获取元件的X和Y坐标,并加入一定量的空间得到这个位置。例如,如果元件是在10,10,绘制的箭头25,25,可以把元件的宽度考虑而决定在哪里绘制的箭头。您也应该检查左侧或右侧是否有更多的可用空间,并借鉴了一边。此外,可以绘制的箭头在一侧,而在另一文本如果该元素是靠近中间。 在所绘制的箭头,就可以显示出与屏幕的另一部分的帮助内容的文本框。你可以存储在XML中的帮助内容,并显示相应的字符串此元素。 删除在preparation箭头和文本框的下一个元素。