不能完全理解这一点。我的活动上有一个按钮,一旦按下该按钮便会打开通知。此自定义通知上带有一个按钮。我试图更改通知背景图片,一旦按下它。
这是我到目前为止没有运气的东西。
这是一个服务类,一旦按下“ notifcation_Button”,就会被调用。 (我有一个待定的意向调用此类)
using (SqlDataReader timereader = timecommand.ExecuteReader())
{
while (timereader.Read())
{
// just read the DateTime value as such
DateTime dt = timereader.GetDateTime(0);
// then do whatever you need to do with this DateTime value .....
}
connection.Close();
}
答案 0 :(得分:1)
我认为您可以在custom_layout.xml文件中为父视图提供一个ID。在您的代码中使用其ID获取该父视图的引用,并更改该视图的背景图像以实现所需的结果。
答案 1 :(得分:0)
因此,任何人都想知道的问题是NotificationCompat.Builder没有被更新,因此无论您最初拥有它的位置,都需要使用remoteView.setInt(R.id.yourDrawable,“ setBackgroundResource”,newDrawable);进行更新。要么将其扔进一个方法中,然后以这种方式进行更新,要么将整个傻瓜带入发生更改的类中。