【发布时间】:2020-03-23 17:05:03
【问题描述】:
【问题讨论】:
-
这样的动态图标没有通用 API。这些图标通常用于与设备/启动器一起打包的应用程序,因为它是必须支持该功能的启动器应用程序。可能有特定的启动器确实提供了一些方法来做到这一点,但它不会在所有地方都相同。
标签: android real-time android-icons adaptive-icon
【问题讨论】:
标签: android real-time android-icons adaptive-icon
您必须为此创建一个小部件应用程序,
https://developer.android.com/guide/topics/appwidgets#
理想情况下,您将与
进行活动<activity android:name=".ClockChoice">
</activity>
它由您的 xml 中的模拟时钟组成,例如
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<AnalogClock
android:layout_marginTop="20dp"
android:layout_marginLeft="120dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
然后按照https://developer.android.com/guide/topics/appwidgets# 文档添加小部件
【讨论】: