小编Sur*_*mar的帖子

android 7.0通知图标出现白色方块

我使用下面的代码片段在我的Android应用程序中生成通知.

private void sendNotification(String contentText, String message) {

    Intent resultIntent = new Intent(this, MainActivity.class);
    resultIntent.putExtra("clear","clear");
    resultIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | 
     Intent.FLAG_ACTIVITY_CLEAR_TASK);

   PendingIntent piResult = PendingIntent.getActivity(this, 0, resultIntent,0);

    NotificationCompat.Builder builder=new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.icon)
            .setColor(ContextCompat.getColor(getApplicationContext(),R.color.red))
            .setContentTitle("title")
            .setContentText(message)
            .setAutoCancel(true)
            .setLargeIcon(BitmapFactory.decodeResource(getResources() 
            ,R.drawable.notification))
            .setContentIntent(piResult);

    NotificationCompat.InboxStyle notification = new NotificationCompat.InboxStyle(builder);

    int i;
    for(i=0; i<messageList.size();i++){
        notification.addLine(messageList.get(i));
    }
    notification.setBigContentTitle("title");
    notification.setSummaryText(contentText);

    NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.notify(NOTIFICATION_ID,notification.build());
}
Run Code Online (Sandbox Code Playgroud)

它适用于android 5和6但是对于android nougat它不起作用

android android-notifications android-7.0-nougat

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

使用html和CSS的按钮徽章

大家好,我正在尝试做这样的事情

在此输入图像描述

我需要按钮

到目前为止,我尝试使用SVG和这样的按钮

<div style="position:relative;">
        <div style="border-radius:50px;background-color:#F3B200;border:2px solid;width:35px;height:35px;position:absolute;left:84%;margin-top:-18px;">
        <center>5</center>
        </div>
        <div>
            <button class="btn btn-success btn-lg" style="width:170px;">
            <center> MYbutton</center>
         </button>
         </div>
         </div> 
Run Code Online (Sandbox Code Playgroud)

但这并不适用.我需要它才能做出回应.

html5 css3

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

Rails 4.1.6从表单中插入不保存在数据库中

下面是我的控制器代码

class AdminController < ApplicationController
  def new
    DashboardUser.create(
      :USER_NAME => params[:user_name],
      :PASSWORD => params[:password],
      :LAST_NAME => params[:last_name],
      :FIRST_NAME => params[:first_name],
      :MIDDLE_NAME => params[:middle_name],
      :PHONE => params[:phone]
     )
  end
  private
  def dashboard_params
  params.require(:dashboard_user).permit(:id, :user_name, :password, :last_name, :first_name, :middle_name , :phone)
  end
end
Run Code Online (Sandbox Code Playgroud)

下面是我的型号代码

class DashboardUser < ActiveRecord::Base
  self.table_name = "dashboard_user"
end
Run Code Online (Sandbox Code Playgroud)

下面是我的html.erb代码

<%= form_tag("/admin/user_creation", :method=>"post") do %>
    <%= text_field_tag(:user_name) %>
    <%= password_field_tag(:password) %>
    <%= text_field_tag(:last_name) %>
    <%= text_field_tag(:first_name) %>
    <%= text_field_tag(:middle_name) %>
    <%= text_field_tag(:phone) %>
    <%= submit_tag("Add User", :class=>"btn") %>
    <% …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails

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