1

我在布局的根目录中有一个带有 RelativeLayout 的自定义通知。我需要将背景图像设置为此RelativeLayout。我有一个图片网址,然后我使用毕加索下载位图。有没有办法将位图设置为自定义通知?

所有答案都是关于位于资源中的设置颜色或图像remoteView.setInt(R.id.viewid, "setBackgroundResource", R.color.your_color)

4

1 回答 1

2

不幸的是,我无法为RelativeLayout 添加背景,但我找到了一种解决方法。我做了这样的布局

<FrameLayout>
    <ImageView android:layout_width="match_parent"
               android:layout_height="match_parent"/>
    <RelativeLayout android:layout_width="match_parent"
               android:layout_height="match_parent"/>
</FrameLayout>

ImageView 现在作为背景工作,因为它首先出现在 FrameLayout 中。

于 2018-02-08T05:18:51.573 回答