<RelativeLayout
android:id="@+id/widget"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/my_background"
android:orientation="vertical" >
现在我想使用RemoteViews将此背景更改为"@drawable/your_bck"。 我尝试了类似以下的内容:
Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(),R.drawable.yout_bck);
remoteViews.setImageViewBitmap(R.id.widget, bitmap);
但是后来显示“小部件无法加载”
它必须作为背景,因为我需要在图像中心设置文本 :)