兄弟们,我又有问题向大家请教了

gzm998128gzm 2013-05-11 10:34:48
我调用系统的拍照拍出了一张照片,如下代码所示,我将这个bitmap取出显示在imageView上
Bundle extras = data.getExtras(); 
b = (Bitmap) extras.get("data");

try {
view = (ImageView) findViewById(R.id.imageView1);

view.setImageBitmap(b);
//setContentView(view);
} catch (Exception e) {

throw new RuntimeException(e);
}

现在项目中增加需求要求在照片上加上日期,然后显示在imageView上,我上网查了好多都不怎么好,该怎么在这个取出来的bitmap上画上日期啊,拜托了
...全文
89 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
haoyizsw 2013-05-11
  • 打赏
  • 举报
回复
不知道有没有日期的接口,没用过 我的想法是没有接口的话 你就用画布把日期画上去吧!
gzm998128gzm 2013-05-11
  • 打赏
  • 举报
回复
不要沉啊,传说中的大牛呢???
gzm998128gzm 2013-05-11
  • 打赏
  • 举报
回复
引用 1 楼 lili19821211 的回复:
Android全套精品教学视频 http://item.taobao.com/item.htm?spm=a1z10.1.w4004-1574172318.2.Q9j2mH&id=24950700803
你这是在干什么???不带这么做广告的
haoyizsw 2013-05-11
  • 打赏
  • 举报
回复
引用 5 楼 gzm998128gzm 的回复:
[quote=引用 4 楼 haoyizsw 的回复:] 不知道有没有日期的接口,没用过 我的想法是没有接口的话 你就用画布把日期画上去吧!
提问的时候我的想法就是用画布画,但是我不会啊,还好现在自己在网上找了一个方法,改改,能用了。谢谢了
public Bitmap createBitmap(Bitmap bit)
	{
		int w=bit.getWidth();
		int h=bit.getHeight();
		Bitmap newmap=Bitmap.createBitmap(w,h,Config.ARGB_8888 );
		Paint paint=new Paint();
		paint.setColor(Color.RED);
		paint.setTextSize(24);
		Canvas cv = new Canvas( newmap );
		cv.drawBitmap( bit, 0, 0, null );//在 0,0坐标开始画入bit  
		
		cv.drawText("nihao",  w - 100, h -  20,paint );//在bit的右下角画入水印
		cv.save( Canvas.ALL_SAVE_FLAG );//保存 
		cv.restore();//存储  
		return newmap;
		
	}

view = (ImageView) findViewById(R.id.imageView1);   
                 
                 picture=createBitmap(b);
                 view.setImageBitmap(picture);
这样就解决了[/quote] 这个就是画布画出来了的
gzm998128gzm 2013-05-11
  • 打赏
  • 举报
回复
引用 4 楼 haoyizsw 的回复:
不知道有没有日期的接口,没用过 我的想法是没有接口的话 你就用画布把日期画上去吧!
提问的时候我的想法就是用画布画,但是我不会啊,还好现在自己在网上找了一个方法,改改,能用了。谢谢了
public Bitmap createBitmap(Bitmap bit)
	{
		int w=bit.getWidth();
		int h=bit.getHeight();
		Bitmap newmap=Bitmap.createBitmap(w,h,Config.ARGB_8888 );
		Paint paint=new Paint();
		paint.setColor(Color.RED);
		paint.setTextSize(24);
		Canvas cv = new Canvas( newmap );
		cv.drawBitmap( bit, 0, 0, null );//在 0,0坐标开始画入bit  
		
		cv.drawText("nihao",  w - 100, h -  20,paint );//在bit的右下角画入水印
		cv.save( Canvas.ALL_SAVE_FLAG );//保存 
		cv.restore();//存储  
		return newmap;
		
	}

view = (ImageView) findViewById(R.id.imageView1);   
                 
                 picture=createBitmap(b);
                 view.setImageBitmap(picture);
这样就解决了

80,354

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧