第一个:popupWindow
//创建一个pop实例化对象 popupWindow = new PopupWindow(); //设置pop的view视图 View view=View.inflate(this,R.layout.foot,null); popupWindow.setContentView(view); //给pop设置宽和高 popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT); popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); //设置pop外面点击消失 popupWindow.setOutsideTouchable(true); popupWindow.setBackgroundDrawable(new ColorDrawable()); //给pop的菜单设置点击事件 TextView textView=view.findViewById(R.id.title1); TextView textView1=view.findViewById(R.id.title2); textView.setOnClickListener(this); textView.setOnClickListener(this);
第二个:1.通知栏 notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); Intent intent=new Intent(this,Main2Activity.class); PendingIntent pendingIntent=PendingIntent.getActivity(this,1,intent,PendingIntent.FLAG_CANCEL_CURRENT); Notification notification= new Notification.Builder(this) .setSmall