模糊启动器小部件背景
Blurring the launcher widget background
我正在开发一个时钟启动器小部件(添加到启动器的那个)。
我在位图上手动绘制时间,然后执行
ComponentName thisWidget = new ComponentName(context, MyWidgetProvider.class);
AppWidgetManager manager = AppWidgetManager.getInstance(context);
RemoteViews remoteViews = new RemoteViews(context.getPackageName(),
R.layout.widget_layout);
// Set the text
SimpleDateFormat timeFormat = new SimpleDateFormat("hh:mm a", Locale.US);
remoteViews.setImageViewBitmap(R.id.imageView, buildUpdate(context, timeFormat.format(new Date()))); //update imageView with a new bitmap with drawn time
manager.updateAppWidget(thisWidget, remoteViews);
我想要的是另外模糊小部件的背景(小部件下的墙纸)。
我知道如何模糊位图,但这种情况下我没有要模糊的位图,因为我想我无法获得小部件下的背景部分。
那么有什么办法可以把小部件的背景虚化吗?
请注意!我知道如何模糊位图。但我不需要那样做。
这是不可能的,因为无法让小部件底层位图应用模糊。您只能创建部分透明的背景。
我正在开发一个时钟启动器小部件(添加到启动器的那个)。
我在位图上手动绘制时间,然后执行
ComponentName thisWidget = new ComponentName(context, MyWidgetProvider.class);
AppWidgetManager manager = AppWidgetManager.getInstance(context);
RemoteViews remoteViews = new RemoteViews(context.getPackageName(),
R.layout.widget_layout);
// Set the text
SimpleDateFormat timeFormat = new SimpleDateFormat("hh:mm a", Locale.US);
remoteViews.setImageViewBitmap(R.id.imageView, buildUpdate(context, timeFormat.format(new Date()))); //update imageView with a new bitmap with drawn time
manager.updateAppWidget(thisWidget, remoteViews);
我想要的是另外模糊小部件的背景(小部件下的墙纸)。
我知道如何模糊位图,但这种情况下我没有要模糊的位图,因为我想我无法获得小部件下的背景部分。
那么有什么办法可以把小部件的背景虚化吗?
请注意!我知道如何模糊位图。但我不需要那样做。
这是不可能的,因为无法让小部件底层位图应用模糊。您只能创建部分透明的背景。