在哪里可以找到有关创建自定义 Android 锁屏的示例或教程?
我对 Android 很感兴趣,并且一直在尝试寻找有关创建自定义锁屏的示例或教程。
我想创建新的锁定屏幕以方便访问。
例如
- 快速访问相机。
- 快速访问电话拨号。
- 使用语音 解锁屏幕。
我想为盲人设计锁屏。
I'm interested about Android and have been trying to find an example or tutorial about creating a custom lockscreen.
I wanna create new lock screen for easy accessibilities.
For example
- fast access to camera.
- fast access to phone dial.
- Using Speech to
unlock screen.
I want to design the lock screen for blind people.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
看看这个答案。
您需要编写自己的主屏幕应用程序来实现您所需的锁屏行为。 Android SDK 中有用于编写您自己的主屏幕应用程序的示例代码(源代码)。
Have a look at this answer.
You need to write your own home screen app which will implement the lockscreen behaviour that you require. There is sample code for writing your own home screen app in the Android SDK(Source code).
如果您有本机源代码,这就是 Google 实现锁屏代码的地方
androidgingerbread/frameworks/base/policy/src/com/android/internal/policy/impl/LockScreen.java
这得到内置于 android.policy.jar 中。
我想说实现您想要的最好方法是编写一个具有上述所需功能的新主屏幕应用程序。
If you have the native source code, this is where Google has implemented the lock screen code
androidgingerbread/frameworks/base/policy/src/com/android/internal/policy/impl/LockScreen.java
This gets built into android.policy.jar.
I would say the best way to achieve what you are trying is to write a new homescreen app with required features as stated above.
据我所知,Google 尚未发布 API 允许您在未 root 的设备上更改锁定屏幕。
As far as I know, Google hasn't released an API that allows you to change the lock-screen on un-rooted devices.
Android 5.0 及更高版本中已弃用锁屏小部件。为了帮助填补这一空白,您可以使用 Adenda SDK。它扩展了 Android 堆栈,让您可以像使用任何其他应用程序一样在锁定屏幕上设计和编程布局,并将它们输入 SDK 中。
例如:
我隶属于 Adenda 以便全面披露
Lock screen widgets were deprecated in Android 5.0 and above. To help fill the void, you can use the Adenda SDK. It extends the Android stack to let you design and program your layouts on the lock screen like you would with any other app, and feed them into the SDK.
For example:
I'm affiliated with Adenda for full disclosure
我写了一篇关于如何编写简单的Android锁屏< /a>
简而言之,您可以运行一个包含 BroadcastReceiver 的服务,该服务将侦听
Intent.ACTION_SCREEN_OFF
的任何事件,然后您可以使用以下命令在所有内容之上绘制自定义锁定屏幕android.permission.SYSTEM_ALERT_WINDOW
。I wrote a post about How to write simple Android Lock Screen
In short, you can run a service that contains BroadcastReceiver that will listen to any event of
Intent.ACTION_SCREEN_OFF
, then you can draw your custom Lock Screen on top of everything by usingandroid.permission.SYSTEM_ALERT_WINDOW
.