相关疑难解决方法(0)

更改通知布局

我反编译我的系统音乐应用程序(来自索尼爱立信Android版2.3.7),因为我想更改通知布局.我找到了使用此代码创建通知的方法:

private void sendStatusBarNotification(Track paramTrack)
{
    if (paramTrack != null)
    {
        NotificationManager localNotificationManager = (NotificationManager)this.mContext.getSystemService("notification");
        String str = paramTrack.getArtist();

        if ((str == null) || (str.equals(this.mContext.getString(2131361954))))
            str = this.mContext.getString(2131361798);

        Notification localNotification = new Notification(2130837696, paramTrack.getTitle() + " - " + str, System.currentTimeMillis());
        localNotification.flags = (0x2 | localNotification.flags);
        localNotification.flags = (0x20 | localNotification.flags);

        PendingIntent localPendingIntent = PendingIntent.getActivity(this.mContext, 0, new Intent(this.mContext, MusicActivity.class), 268435456);
        localNotification.setLatestEventInfo(this.mContext, paramTrack.getTitle(), str, localPendingIntent);
        localNotificationManager.notify(0, localNotification);
    }
}
Run Code Online (Sandbox Code Playgroud)

我现在的问题是:如何更改通知布局?我想构建一个看起来像原始Android通知布局但在通知右侧有一个额外图像的布局.我怎样才能做到这一点?

android android-layout android-notifications

33
推荐指数
2
解决办法
5万
查看次数