在定制化10.0的项目开发中,在Launcher3的app列表页,有时钟app的图标,由于图标是静态的
开发的需要要求调成动态图标,时刻显示时间,所以要把时钟图标替换成动态图标
- packages/apps/Launcher3/src/com/android/launcher3/BubbleTextView.java
- packages/apps/Launcher3/src/com/android/launcher3/Launcher.java
在Launcher3 workspace 第二屏app列表页中 默认的时钟app图标是静态图标 就是时间不会变化的
但这也显然不符合要求,时间是时刻都在变化的 下面就来定制化时钟动态图标
- package com.android.launcher3;
- import android.content.Context;
- import android.graphics.*;
- import com.android.launcher3.R;
- public class IconUtil {
- private static final String TAG = "IconUtil";
- private static Bitmap getBitmap(Context context, int res) {
- BitmapFactory.Options options = new BitmapFactory.Options();
- options.inPreferredConfig = Bitmap.Config.ARGB_4444;
- return BitmapFactory.decodeResource(context.getResour