如何在android中模糊小部件图标的背景?

如何在android中模糊小部件图标的背景?,android,background,widget,imageview,blur,Android,Background,Widget,Imageview,Blur,我试图在小部件图标的背景上添加一个模糊效果,这样小部件图标可以有一个模糊的背景。谷歌搜索了很多,但没有给出明确的答案。有谁能建议我如何使用推荐链接吗?谢谢你的帮助 下面是我用于小部件的XML代码 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_

我试图在小部件图标的背景上添加一个模糊效果,这样小部件图标可以有一个模糊的背景。谷歌搜索了很多,但没有给出明确的答案。有谁能建议我如何使用推荐链接吗?谢谢你的帮助

下面是我用于小部件的XML代码

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" 
    android:layout_gravity="center">

    <ImageView
        android:id="@+id/toggle"
        android:contentDescription="@string/content"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/offw" />


</LinearLayout>
下面是app_widget provider的代码

<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" 
    android:widgetCategory="keyguard|home_screen"
    android:minWidth="36dip"
    android:minHeight="36dip"
    android:updatePeriodMillis="86400000"
    android:initialLayout="@layout/main"

/>

转到您的小部件xml布局

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:orientation="vertical" 
  android:background="@drawable/blureffect"
  android:layout_gravity="center">
在res/drawable/目录中创建一个xml文件名,并将其粘贴到该文件的下面代码中

 <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
    android:startColor="#9f4b91"
    android:centerColor="#563fdf"
    android:endColor="#9f4b91"
    android:type="linear"
    android:angle="0"/>
 </shape>

显示你的小部件xml代码你根本没有搜索:这个问题似乎离题了,因为它显示在SOI之外没有搜索答案。我已经更新了问题中的小部件xml代码@raj@FrankN.Stein我已经尽可能多地在谷歌上搜索了。可以通过此链接模糊图像视图。但是它不能帮助我模糊我的小部件。我想要的只是小部件背景中的模糊效果。