Android 實用小控件大雜燴

1,spinner實現下拉框 php

http://www.cnblogs.com/tinyphp/p/3858920.html html

spinner獲取選中值得方法 java

http://zhidao.baidu.com/link?url=tsoQDSU_-lTNpSWzaT66twdrl71idW78_X2uCxc_S3r78_HbcCRpsBNoRmX4a92ujaUvcRYzIw-TZ0oMbJpTdq android

2,AlarmManager使用 數據庫

http://blog.csdn.net/wangxingwu_314/article/details/8060312 app

      以前在這個問題上糾結了很久。要如何實現添加時間後按時提醒,。其實裏面的pending 就是一種按設定時間提醒的intent,因而我把代碼改爲在每次添加時間後都發送一個pending就好了。。,, ide

還有個問題就是在有多個提醒時間的時候。要設置標誌值來區別,能夠直接用數據庫裏面的數據行的下標來區分。 ui

mAlarm= (AlarmManager) getSystemService(Service.ALARM_SERVICE);
                        Intent intent=new Intent(add_task.this, MyReceiver.class);
                        Bundle data=new Bundle();
                        data.putString("task",tasktext);
                        data.putString("date",datetext);
                        intent.putExtras(data);

                        PendingIntent pendingIntent=PendingIntent.getBroadcast(add_task.this,alarm_id,intent,0);

alarm_id
爲區分標誌

SQLiteDatabase db=mySqliteHelper.getWritableDatabase();
        alarm_id= (int) db.insert("my_table", null, values);
        db.close();
    }



能夠直接用插入數據庫後的返回下標來標誌。







3.Log輸出 this

http://blog.csdn.net/alley_zhang/article/details/5713894 url

4.Notification

http://blog.csdn.net/loongggdroid/article/details/17616509

http://www.jb51.net/article/77725.htm


5.APP啓動界面加載圖片

http://blog.csdn.net/tangcheng_ok/article/details/37654757

5.二級可展開列表

http://www.tuicool.com/articles/JBZb6zy

6.textview數據變化觸發相應事件

http://www.oschina.net/question/920274_172775?fromerr=GHFezDb3

7.app調用系統分享功能

http://www.2cto.com/kf/201504/390393.html

順便附上本身寫的源碼


final String   shareText=need_time+",我在pumkin裏面經過完成"+dateWoods.done_on+"個任務後種植成功了"+dateWoods.done_on+"個南瓜。你也來試試吧!\r\n(下載地址)";
                //分享功能
                share.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent=new Intent();
                        intent.setAction(Intent.ACTION_SEND);
                        intent.putExtra(Intent.EXTRA_TEXT, shareText);
                        intent.setType("text/plain");
                        startActivity(Intent.createChooser(intent,"分享到"));
                    }
                });
8.設置按鈕的顯示與隱藏

隱藏


for(int i=0;i<last_code;i++){
                    ngs[i].setVisibility(View.GONE);
                }
顯示


for(int i=0;i<code;i++){
                    ngs[i].setVisibility(View.VISIBLE);
                }

9.Notification

http://www.jb51.net/article/77725.htm


Notification notify2 = new Notification.Builder(context)
                    .setSmallIcon(R.drawable.pumpkin_icon_aa) // 設置狀態欄中的小圖片,尺寸通常建議在24×24,這個圖片一樣也是在下拉狀態欄中所顯示,若是在那裏須要更換更大的圖片,能夠使用setLargeIcon(Bitmap
                            // icon)
                    .setTicker("TickerText:" + "您有新短消息,請注意查收!")// 設置在status
                            // bar上顯示的提示文字
                    .setContentTitle(task)// 設置在下拉status
                            // bar後Activity,本例子中的NotififyMessage的TextView中顯示的標題
                    .setContentText(date)// TextView中顯示的詳細內容
                    .setContentIntent(pendingIntent1) // 關聯PendingIntent
                    .setNumber(1) // 在TextView的右方顯示的數字,可放大圖片看,在最右側。這個number同時也起到一個序列號的左右,若是多個觸發多個通知(同一ID),能夠指定顯示哪個。
                    .getNotification(); // 須要注意build()是在API level
            // 16及以後增長的,在API11中能夠使用getNotificatin()來代替
            notify2.flags |= Notification.FLAG_AUTO_CANCEL;
//        notify2.defaults |= Notification.DEFAULT_VIBRATE;//添加震動
     /*   long[] vibrates = {0, 2000, 1000, 2000,1000,2000};    //靜止和震動間隔交替時間,第一個靜止,第二個震動
       notify2.vibrate = vibrates;*/

            long[] vibrates = {0, 5000};    //靜止和震動間隔交替時間,第一個靜止,第二個震動
            notify2.vibrate = vibrates;

            manager.notify(2, notify2);



10,APK打包

http://blog.csdn.net/xiaozhi0999/article/details/40864523

其實跑過應用以後,android studio 在app\build\outputs\apk目錄下就會生成apk安裝包,有時候只是圖標不對誤讓你覺得不是APK


11.懸浮框實現

http://www.cnblogs.com/mengdd/p/3824782.html

相關文章
相關標籤/搜索