1

1 つの通知アプリケーションを作成しています。

ただし、アプリケーションはtext代わりに必要ですicon/image

参考画像:http ://tinypic.com/view.php?pic=23hu5xd&s=6

私はこの方法を使用してすべての通知を正常に作成していますが、ステータスバーにテキストが必要です。

NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
                    this).setSmallIcon(R.drawable.ic_launcher)
                    .setContentTitle("hiii") // title for notification
                    .setContentText("Hello word") // message for notification
                    .setAutoCancel(false); // clear notification after click

            Intent intent = new Intent(this, MainActivity.class);
            PendingIntent pi = PendingIntent.getActivity(this, 0, intent,Intent.FLAG_ACTIVITY_NEW_TASK);
            mBuilder.setContentIntent(pi);
            mNotificationManager.notify(0, mBuilder.build());

問題: 画像の代わりにテキストを設定する方法。setSmallIcon(R.drawable.ic_launcher)

4

1 に答える 1

2

画像を設定するしかありません。画像にテキストが含まれていることを歓迎します。

引用したスクリーンショットでは、アプリにはおそらく、さまざまなパーセンテージ レベルで選択できる画像が 100 個まであります。これらを 1 つの にまとめてからLevelListDrawable、 の 2 つのパラメータ バージョンを使用して、setSmallIcon()必要なレベルを指定できます。

于 2013-10-05T10:18:15.317 に答える