通知バーにアイコンを表示しようとしています。 アイコンはレベルを設定してコンテンツを変更できるLevelListDrawableです。 問題は通知のアイコンにレベルを設定できないことです。 "Notification.icon"と "Notification.iconLevel"を使用しようとしましたが、動作しません。通知バーにLevelListDrawableを表示
ここは私のコードです。誰が間違っているのを見ることができますか?ここで
Notification notification = new Notification(R.drawable.ic_stat_notify, "", System.currentTimeMillis());
notification.icon = R.drawable.ic_stat_notify;
notification.iconLevel = 30;
notification.setLatestEventInfo(context, "Hello", "World", intent);
manager.notify(NOTIFICATION_ID, notification);
は、あなたが展開通知リストで通知のための特定のアイコンを表示したい場合は、あなたがiconLevelなしとの「通常」描画可能で、通知を作成する必要があり、私のLevelListDrawable
?xml version="1.0" encoding="utf-8"?>
level-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/ic_stat_notify_0"
android:minLevel="0"
android:maxLevel="9"/>
<item android:drawable="@drawable/ic_stat_notify_10"
android:minLevel="10"
android:maxLevel="11"/>
<item android:drawable="@drawable/ic_stat_notify_20"
android:minLevel="20"
android:maxLevel="29"/>
<item android:drawable="@drawable/ic_stat_notify_30"
android:minLevel="30"
android:maxLevel="39"/>
<item android:drawable="@drawable/ic_stat_notify_40"
android:minLevel="40"
android:maxLevel="49"/>
<item android:drawable="@drawable/ic_stat_notify_50"
android:minLevel="50"
android:maxLevel="59"/>
<item android:drawable="@drawable/ic_stat_notify_60"
android:minLevel="60"
android:maxLevel="69"/>
<item android:drawable="@drawable/ic_stat_notify_70"
android:minLevel="70"
android:maxLevel="79"/>
<item android:drawable="@drawable/ic_stat_notify_80"
android:minLevel="80"
android:maxLevel="89"/>
<item android:drawable="@drawable/ic_stat_notify_90"
android:minLevel="90"
android:maxLevel="99"/>
<item android:drawable="@drawable/ic_stat_notify_100"
android:minLevel="100"
android:maxLevel="100"/>
</level-list>
レベルリストのXMLを投稿してください。 –
ステータスバーのアイコンがレベルで正しいことがわかりました。しかし、ドロワーの通知ビューで間違っています。 – Dennis