当前位置: 首页 > news >正文

外贸建站行业好做吗网页平台做个业务推广

外贸建站行业好做吗,网页平台做个业务推广,法国企业网站建设,网站建设费用计入无形资产按几年摊销通知栏notification是Android中一个很重要的组件#xff0c;可以在顶部状态栏中存在#xff0c;用户也可以通过此来操作应用#xff0c;在Android中只有3.0以上的版本才加入了notification的按钮点击功能。先看一下仿虾米写出来的通知的效果这是一个自定义的notification可以在顶部状态栏中存在用户也可以通过此来操作应用在Android中只有3.0以上的版本才加入了notification的按钮点击功能。先看一下仿虾米写出来的通知的效果这是一个自定义的notification添加了前一曲、播放、暂停、下一曲等功能自定义的notification需要自己写布局文件并通过remoteview显示在界面中。res/layout/customnotice.xml写了布局之后就需要实例化通知了1.定义一个NotificationManager对象并实例化2.定义一个RemoteViews对象3.设置RemoteViews属性private NotificationManager manager;private RemoteViews remoteViews;manager (NotificationManager) getSystemService(NOTIFICATION_SERVICE);/*** 设置通知*/SuppressLint(NewApi)private void setNotification() {NotificationCompat.Builder builder new Builder(this);Intent intent new Intent(this, MainActivity.class);// 点击跳转到主界面PendingIntent intent_go PendingIntent.getActivity(this, 5, intent,PendingIntent.FLAG_UPDATE_CURRENT);remoteViews.setOnClickPendingIntent(R.id.notice, intent_go);// 4个参数context, requestCode, intent, flagsPendingIntent intent_close PendingIntent.getActivity(this, 0, intent,PendingIntent.FLAG_UPDATE_CURRENT);remoteViews.setOnClickPendingIntent(R.id.widget_close, intent_close);// 设置上一曲Intent prv new Intent();prv.setAction(Constants.ACTION_PRV);PendingIntent intent_prev PendingIntent.getBroadcast(this, 1, prv,PendingIntent.FLAG_UPDATE_CURRENT);remoteViews.setOnClickPendingIntent(R.id.widget_prev, intent_prev);// 设置播放if (Myapp.isPlay) {Intent playorpause new Intent();playorpause.setAction(Constants.ACTION_PAUSE);PendingIntent intent_play PendingIntent.getBroadcast(this, 2,playorpause, PendingIntent.FLAG_UPDATE_CURRENT);remoteViews.setOnClickPendingIntent(R.id.widget_play, intent_play);}if (!Myapp.isPlay) {Intent playorpause new Intent();playorpause.setAction(Constants.ACTION_PLAY);PendingIntent intent_play PendingIntent.getBroadcast(this, 6,playorpause, PendingIntent.FLAG_UPDATE_CURRENT);remoteViews.setOnClickPendingIntent(R.id.widget_play, intent_play);}// 下一曲Intent next new Intent();next.setAction(Constants.ACTION_NEXT);PendingIntent intent_next PendingIntent.getBroadcast(this, 3, next,PendingIntent.FLAG_UPDATE_CURRENT);remoteViews.setOnClickPendingIntent(R.id.widget_next, intent_next);// 设置收藏PendingIntent intent_fav PendingIntent.getBroadcast(this, 4, intent,PendingIntent.FLAG_UPDATE_CURRENT);remoteViews.setOnClickPendingIntent(R.id.widget_fav, intent_fav);builder.setSmallIcon(R.drawable.notification_bar_icon); // 设置顶部图标Notification notify builder.build();notify.contentView remoteViews; // 设置下拉图标notify.bigContentView remoteViews; // 防止显示不完全,需要添加apisupportnotify.flags Notification.FLAG_ONGOING_EVENT;notify.icon R.drawable.notification_bar_icon;manager.notify(100, notify);}PendingIntent是一种特殊的intent设置之后并不会马上使用而是在真正点击后只会调用。Android默认使用的通知高度大概是64dp无法满足大界面的显示所以需要在其中设置bigContentView这样才能显示大图。manager.notify(id, notification)中第一个参数是一个标识码在取消通知的时候需要传入这个参数第二个就是一个notify对象。通知栏一次实例化后里面按钮的点击事件就确定了如果当前设置的是播放的按钮那么暂停是不会起作用的所以需要重新设置通知目前采用的是用Handler来更新通知栏。public Handler handler new Handler() {public void handleMessage(android.os.Message msg) {Mp3Info info (Mp3Info) msg.obj;Bitmap bitmap MediaUtil.getArtwork(getApplicationContext(),info.getId(), info.getAlbumId(), true, false);btm_album.setImageBitmap(bitmap);btm_artist.setText(info.getArtist());btm_title.setText(info.getTitle());// 播放歌曲btm_state.setImageResource(R.drawable.player_btn_radio_pause_normal);// 设置通知栏的图片文字remoteViews new RemoteViews(getPackageName(),R.layout.customnotice);remoteViews.setImageViewBitmap(R.id.widget_album, bitmap);remoteViews.setTextViewText(R.id.widget_title, info.getTitle());remoteViews.setTextViewText(R.id.widget_artist, info.getArtist());if (Myapp.isPlay) {remoteViews.setImageViewResource(R.id.widget_play, R.drawable.widget_btn_pause_normal);}else {remoteViews.setImageViewResource(R.id.widget_play, R.drawable.widget_btn_play_normal);}setNotification();};};在退出的时候需要取消通知栏用NotificationManager的manager对象取消通知view其中的100是notify设置的id用来区别通知因为在其他应用中可能会产生好多通知。Overrideprotected void onDestroy() {Log.i(---TAG, ondestory);super.onDestroy();if (remoteViews ! null) {manager.cancel(100);}if (receiver ! null) {unregisterReceiver(receiver);}}
http://www.sadfv.cn/news/279144/

相关文章:

  • 医药招商网站建设响应式培训网站模板下载
  • 江门网站建设费用定制网站开发的意思
  • 网站首页关键词设置微信开放平台官方网站
  • 网站服务器租用价格 贴吧信息化网站建设引言
  • sql2008做网站做胃肠医院网站
  • 自己怎么做外贸网站网站建设首选公司哪家好
  • 建设网站的价格是多少网站目录优化
  • 学院网站整改及建设情况报告企业网站官网模板
  • 烟台专业网站制作公司产品设计工具
  • 乡镇网站模板wordpress 主题 排行
  • 移动网站自助制作电商平台需要什么资质
  • 引擎搜索大全企业网站seo托管怎么做
  • 班级网站素材下载aso榜单优化
  • 前端网站开发实例视频tp5被黑做的网站全变成首页
  • 网站设计培训基地做字画的网站
  • 30岁转行做网站编辑织梦同时运行多个网站
  • 黑龙江生产建设兵团各连网站保定风泉网络科技有限公司
  • 运城网站推广学校网站意义
  • 创科手机网站集美培训网站建设
  • 抖音短剧推广平台有哪些株洲seo优化加盟
  • 做我的世界背景图的网站门户网页
  • 企业开展网站建设软件工程师月薪
  • 门户网站 建设 如何写网上平面设计培训
  • 市网站建设公司宿迁房产网查备案
  • 网站建站的技术解决方案模拟登录wordpress
  • 购物网站建设机构网页布局设计说明
  • 餐饮手机微网站怎么做做网站分前台后端吗
  • 大连网站制作的公司成都专业网站建设公司排名
  • 做网站服务好中国建设银行官网站积分抽奖
  • 做图模板网站有哪些内容展示型网站建设报价