Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> Android開發 >> 關於android開發 >> 翻翻git之---一個豐富的通知的工具庫 NotifyUtil

翻翻git之---一個豐富的通知的工具庫 NotifyUtil

編輯:關於android開發

翻翻git之---一個豐富的通知的工具庫 NotifyUtil


P2 正菜環節

今天上的是一個通知的工具庫,作者寫的比較全,使用起來頁比較方便,而且內容少,直接Copy就好了。(國內很多廠商有自己的ROM定制,還有些野生大牛的自己創作,可能效果不同,這裡為未刷機的效果)

效果圖:
這裡寫圖片描述

基礎單行的:

 private void notify_normal_singLine() {
        //設置想要展示的數據內容
        Intent intent = new Intent(mContext, OtherActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
        PendingIntent pIntent = PendingIntent.getActivity(mContext,
                requestCode, intent, PendingIntent.FLAG_UPDATE_CURRENT);
        int smallIcon = R.drawable.tb_bigicon;
        String ticker = "您有一條新通知";
        String title = "雙十一大優惠!!!";
        String content = "仿真皮膚充氣娃娃,女朋友帶回家!";

        //實例化工具類,並且調用接口
        NotifyUtil notify1 = new NotifyUtil(mContext, 1);
        notify1.notify_normal_singline(pIntent, smallIcon, ticker, title, content, true, true, false);
        currentNotify = notify1;
    }

類似這樣的可以自己封,使用很便利。

How to use?

這裡寫圖片描述

把NotifyUtil Copy進自己的項目就好

實現有八種,作者在Demo裡全部演示齊了,分別是

普通類型通知(單行)

普通類型通知(多行)

消息列表通知(含雙圖標)

含大圖類型通知

自定義視圖通知

折疊式雙按鈕通知

進度條通知

Android 5.0 新特性

下載地址:https://github.com/ddwhan0123/NotifyUtil/archive/master.zip

git地址:https://github.com/ddwhan0123/NotifyUtil

 

  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved