2
在我的Android應用程序中,我想創建一個消耗性通知。爲此,我必須設置一個樣式像這樣的通知:創建自己的NotificationStyle
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setSmallIcon(android.R.drawable.ic_menu_info_details);
builder.setContentTitle("My notification");
builder.setContentText("Hello World!");
builder.setStyle(...);
的Android給了我一些風格,我可以用這個方法使用,但我喜歡創造我自己,所以我可以加載在通知的佈局。那我該怎麼做?如果我創建的Style
一個子類,只有這兩種方法:
public Notification build();
public void setBuilder(Builder builder);
那麼,怎樣才能在我的通知加載我自己的佈局? builder.setContent
對我來說是不夠的,因爲那時我只有64dp的版面。