小编Obl*_*ey3的帖子

Android颜色通知图标

我正在开发一个应用程序,我在那里为用户创建通知.我希望图标在状态栏中显示为白色,但在下拉通知菜单中显示时显示为蓝色.以下是Google Store应用程序执行相同操作的示例.

状态栏中的白色通知:

在此输入图像描述

下拉菜单中的彩色通知:

在此输入图像描述

我怎么能复制这个?我需要设置哪些属性?

编辑: 这是我当前的代码 - 我使图像全白,透明背景,所以它在状态栏中看起来很好,但在通知中,图像仍然是相同的白色:

private NotificationCompat.Builder getNotificationBuilder() {
        return new NotificationCompat.Builder(mainActivity)
                .setDeleteIntent(deletedPendingIntent)
                .setContentIntent(startChatPendingIntent)
                .setAutoCancel(true)
                .setSmallIcon(R.drawable.skylight_notification)
                .setColor(ContextCompat.getColor(mainActivity, R.color.colorPrimary))
                .setContentTitle(mainActivity.getString(R.string.notification_title))
                .setContentText(mainActivity.getString(R.string.notification_prompt));
    }
Run Code Online (Sandbox Code Playgroud)

java android colors push-notification android-notifications

34
推荐指数
5
解决办法
3万
查看次数

Xamarin Studio无法识别供应配置文件

我凭借这些苹果证书结束了我的智慧.我有一个Xamarin.Forms应用程序,我需要使用配置文件签名,以便我可以启用推送通知.但是,Xamarin Studio无法识别我正在制作的任何配置文件.有人可以帮忙吗?

Xamarin Studio尝试链接配置文件,未找到配置文件23devpp: 在此输入图像描述

Xcode找到了.个人资料23devpp: 在此输入图像描述

开发人员窗口的配置文件标记为活动: 在此输入图像描述

xcode ios provisioning-profile xamarin xamarin-studio

14
推荐指数
2
解决办法
1万
查看次数

Django使用Widget来覆盖ModelForm属性

我有一个CharFieldmaxlength为300 的标签,但我需要为默认输入保留100个字符,但我希望用户能够通过输入文本框设置剩余的200个字符.我的工厂是将模型中的字段的最大长度设置为300,并在我的表单中为输入创建一个小部件,将用户的输入限制为200个字符.

但是,我做了一些测试,发现我无法从charfield本身的maxlength更改输入字段的最大长度.有谁知道怎么做?

models.py

class Video(models.Model):
    title = models.CharField(max_length=50)
    tags = models.CharField(max_length=200)
Run Code Online (Sandbox Code Playgroud)

form.py

class VideoForm(forms.ModelForm):

class Meta:
    model=Video
    fields=['title','description','authorId','tags','video','thumbnail']
    #a widget is django's representation of an html input element
    widgets = {
        'tags': forms.Textarea(attrs={'cols': 80, 'rows': 20,'maxlength':5}),
    }
Run Code Online (Sandbox Code Playgroud)

上面代码生成的html textarea是<textarea cols="80" id="id_tags" maxlength="200" name="tags" rows="20"></textarea>,但我希望它maxlength是5.

python forms django widget maxlength

1
推荐指数
1
解决办法
906
查看次数

制作本地警报通知

我正在使用Xamarin和iOS,但是在通知方面我遇到了很多麻烦.我可以创建一个发送到通知中心的本地推送通知,但没有声音或指示通知实际到达.如何使通知成为警报通知,以便在进入通知中心之前显示在屏幕上?

这是我正在生成通知的代码:

//create notification
var notification = new UILocalNotification ();
notification.AlertAction = "Open App";
notification.AlertTitle = "App";
notification.AlertBody = "There has been activity in the app";
notification.SoundName = UILocalNotification.DefaultSoundName;

//display notification
UIApplication.SharedApplication.ScheduleLocalNotification (notification);
Run Code Online (Sandbox Code Playgroud)

编辑:问题不仅仅是声音,而是没有收到警报的反馈,它只是静默地出现在通知中心.我也要求使用此代码的权限:

var settings = UIUserNotificationSettings.GetSettingsForTypes(
                UIUserNotificationType.Alert
                | UIUserNotificationType.Badge
                | UIUserNotificationType.Sound,
                new NSSet());

            UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
            UIApplication.SharedApplication.RegisterForRemoteNotifications();
Run Code Online (Sandbox Code Playgroud)

notifications alert push-notification ios xamarin

1
推荐指数
1
解决办法
200
查看次数