Android开发笔记之日期获取和状态…

来源:互联网 发布:cocos2d-js api 编辑:程序博客网 时间:2024/06/06 17:31
1)日期获取:
SimpleDateFormat sdf=new SimpleDateFormat("MM/dd");  String date=sdf.format(new java.util.Date());
时间可以获取需要调节。例如将("MM/dd");改为("yyyy/MM");等

 

2)安卓开发之上面的系统栏的颜色变化:

http://blog.csdn.net/lidhsr/article/details/44218243

把其提供的资源文件,写到java文件里面并入系统,之后将上面的代码全部黏贴进主文件。之后注意这两个的设置就行了。在相应的xml布局文件里设置。

android:fitsSystemWindows="true"
android:clipToPadding="true"
3)Bitmap 的简单创建和显示
函数:
Bitmap orgImage =((BitmapDrawable) getResources().getDrawable(Integer.valueOf(R.drawable.dongman0))).getBitmap();   //将资源转化为相应的Bitmap
 
 
 temp= Bitmap.createBitmap(
orgImage, //一张大图片
300, //图片上的坐标
300
, //
400-spaces,图片大小,长和宽
600-spaces
);
canvas.drawBitmap(
temp,
400, //显示在屏幕上的坐标
400,
new Paint()

);
0 0