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

相关文章
相关标签/搜索