Android----一些巧妙的效果代码


  1.让一个图片透明:

	Bitmap buffer = Bitmap.createBitmap(width, border="1" Height, Bitmap.Config.ARGB_4444);buffer.eraseColor(Color.TRANSPARENT);
  2.直接发送邮件:
     Intent intent = new Intent(Intent.ACTION_SENDTO, Uri .fromParts( "mailto" , "test@test.com" , null ));
   intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);

  3.程序控制屏幕变亮:

     WindowManager.LayoutParams lp = getWindow().getAttributes();
   lp.screenBrightness = 100 / 100 .0f;
   getWindow().setAttributes(lp);
  4.过滤特定文本
Filter filter = myAdapter.getFilter();
filter.filter(mySearchText);
  5.scrollView scroll停止事件
setOnScrollListener( new OnScrollListener(){
			public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
		    
			}
			public void onScrollStateChanged(AbsListView view, int scrollState) {
				 if (scrollState == 0 ) {
					 Log.i( "a" , "scrolling stopped..." ); 
				 } 
			}
		});

  6. 对于特定的程序 发起一个关联供打开
Bitmap bmp = getImageBitmap(jpg);
		 String path = getFilesDir().getAbsolutePath() + "/test.png" ;
		 File file = new File(path);
		 FileOutputStream fos = new FileOutputStream(file);
		 bmp.compress( CompressFormat.PNG, 100, fos );
		 fos.close();
		 Intent intent = new Intent();
		 intent.setAction(android .content.Intent.ACTION_VIEW);
		 intent.setDataAndType(Uri .fromFile( new File(path)), "image/png");


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值