NotificationCompat android - how to show only Large icon without small

后端 未结 5 1834
轻奢々
轻奢々 2021-01-04 10:59

When I add notification:

        NotificationCompat.Builder mBuilder =
                            new NotificationCompat.Builder(this)  
              .set         


        
5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-04 11:29

    get the small icon id and then try to hide it

    int smallIconId = ctx.getResources().getIdentifier("right_icon", "id", android.R.class.getPackage().getName());
    if (smallIconId != 0) { 
        if (notification.contentView!=null)
            notification.contentView.setViewVisibility(smallIconId, View.INVISIBLE);
    }
    

    try looking at this post it will help too

    i test the code on api 18,23 (samsung j1,galaxy S6) work fine

提交回复
热议问题