如何在 Android 中创建半透明灰色教程叠加层? [英] How do I create the semi-transparent grey tutorial overlay in Android?

查看:37
本文介绍了如何在 Android 中创建半透明灰色教程叠加层?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您知道当您第一次运行 Android 设备时(如果您使用模拟器,您会看到很多东西),有一个关于如何使用启动器和添加小部件等的有用小教程.我正在尝试在谷歌上找到这样的例子,但我不能.我希望你明白我的意思.它是每一步都带有蓝色确定"按钮的那个.

无论如何,我想为我的应用创建一个,但我不确定哪种方法最好.

我是否可以创建一个 Fragment,在我的常规活动之上使其半透明,并让它仅在第一次运行时显示?

我是否为教程的每个部分制作一个半透明的 .png 并在第一次运行时将其覆盖在常规启动器活动上?

如果我选择后者,我该如何调整所有不同的屏幕尺寸?我可以在 Photoshop 中将图像渲染为各种尺寸,但这不会涵盖所有尺寸.如果我走片段路线,我可以说match_parent"而不必担心.但随后我必须弄清楚 Fragments 是如何工作的,它们让我很困惑.

解决方案

我认为这个开源库正是您要找的:

获取源代码和设置说明.

You know when you run an Android device for the first time (something you see a lot if you use the emulator) that there's a helpful little tutorial about how to use the launcher and add widgets, etc. I'm trying to find an example of this on Google, but I can't. I'm hoping you know what I mean. It's the one with the blue "okay" buttons at each step.

Anyway, I want to create one for my app, but I'm not sure which is the best way to go about doing it.

Do I create a Fragment that I can make semi-transparent on top of my regular activity and have it show up on only the first run?

Do I make a semi-transparent .png for each section of the tutorial and overlay it over the regular launcher activity on the first run?

If I do the latter, how can I adjust for all the various screen sizes? I could just render the image in Photoshop to various dimensions, but that won't cover all of them. If I go the fragment route, I can just say "match_parent" and not worry about it. But then I have to figure out how Fragments work, and they confuse the hell out of me.

解决方案

I think this open-source library is exactly what you're looking for:

Showcase View

You can grab the source code and setup instructions from GitHub.

这篇关于如何在 Android 中创建半透明灰色教程叠加层?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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