当前位置:广州蚂蚁搬家 > 搬家新闻 > 正文                                                                            网站TAG搬家 搬家公司 广州搬家 广州 广州大众 广州搬家公司
网 址:www.gzbanjia.com
花都搬家:020-28138822
蚂蚁传真:020-28138822
夜间值班:15622320032
业务联系:李经理、谢经理
地 址:花都三东大道东8号
点击这里开始搬家

android

作者:admin 浏览: 发布时间:13/06/14 关键字: 广州吊机器


    /**     * 自定义款式通知     */    private void showCustomNoti() {        RemoteViews views = new RemoteViews(getPackageName(), R.layout.custom);        Intent intent = new Intent(INTENT_ACTION);        intent.putExtra("isPlay", true);                PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0);        views.setOnClickPendingIntent(R.id.play_pause_music, pendingIntent);        NotificationCompat.Builder builder = new NotificationCompat.Builder(this)            .setContent(views)            .setDefaults(Notification.DEFAULT_ALL)            .setLargeIcon(icon)            .setSmallIcon(R.drawable.music_icon)            .setTicker("Custom Notification")            .setOngoing(true);        mNotiMgr.notify(CUSTOM_NOTI_ID, builder.build());    }

自界说告诉结构文件:custom.xml

final NotificationCompat.Builder builder = new NotificationCompat.Builder(this)            .setContentInfo(String.valueOf(++progressNum))            .setContentTitle("Picture Download")            .setContentText("Download in progress")            .setDefaults(Notification.DEFAULT_ALL)            .setLargeIcon(icon)            .setSmallIcon(R.drawable.stat_notify_gmail)            .setTicker("Progress Notification")            .setOngoing(true);        // Start a lengthy operation in a background thread        new Thread(new Runnable() {            @Override            public void run() {                int incr;                // Do the "lengthy" operation 20 times                for (incr = 0; incr <= 100; incr+=5) {                    builder.setProgress(100, incr, false);                    mNotiMgr.notify(PROGRESS_NOTI_ID, builder.build());                                        try {                        Thread.sleep(1000);                    } catch (InterruptedException e) {   广州吊机器                      Log.d(TAG, "sleep failure");                    }                }