답변

1

원격보기를 사용하여 사용자 지정 알림을 만들 수 있습니다. 그런 원격보기에서는 알림의 레이아웃을 자유롭게 디자인 할 수 있지만 디자인에 대한 Android 가이드 라인을 따르라고 조언합니다.

확장 된 알림보기를 만드는 방법에 대한 자세한 정보는 here을 참조하십시오.

1

자신의 레이아웃을 사용해야합니다.

이제는 모든 것을 위해 빌더를 사용해야하기 때문에 더 이상 사용되지 않지만 때로는 특별한 것을해야 할 때가 있습니다.

String ns = Context.NOTIFICATION_SERVICE; 
    mNotificationManager = (NotificationManager) ctx.getSystemService(ns); 

    int icon = R.drawable.icon; 
    CharSequence tickerText = "Ticker Text"; 
    long when = System.currentTimeMillis(); 

    notification = new Notification(icon, tickerText, when); 
    String packageName = ctx.getPackageName(); 
    contentView = new RemoteViews(packageName, R.layout.notificationlayout); 
    notification.contentView = contentView; 
    contentView.setTextViewText(R.id.textView1, "Text"); 
    Intent notificationIntent = new Intent(ctx, TargetActivity.class); 
    PendingIntent contentIntent = PendingIntent.getActivity(ctx, 0, notificationIntent, 0); 
    notification.contentIntent = contentIntent; 


    mNotificationManager.notify(NOTIFICATION_ID, notification);