两种方法,1,canvas.drawBitmap();2,drawable.draw(canvas);Bitmap.Config.ARGB_8888:代表的是RGB每个占8个字节,透明度通道占8个字节。首先是使用InputStream is= context.getResources().openR...
分类:
移动开发 时间:
2015-07-13 00:38:42
阅读次数:
134
1.修改TextView字体mTextView = (TextView) findViewById(R.id.textview1);mTextView.setText("I am here");Resources resources = getBaseContext().getResources()...
分类:
移动开发 时间:
2015-07-11 17:57:10
阅读次数:
152
DrawablenewDrawable=getResources().getDrawable(mImageIds[newState]).mutate();DrawableoldDrawable=getResources().getDrawable(mImageIds[oldState]).mutate();Bitmapbitmap=null;bitmap=Bitmap.createBitmap(width,bitmapHeight,Bitmap.Config.ARGB_8888);Canvascanvas=n..
分类:
其他好文 时间:
2015-07-09 22:52:03
阅读次数:
370
btn.setTextColor(mContext.getResources().getColor(R.color.selector_sku_btn_tv));这个是定义在String里的如果是xml里的话要XmlPullParserxrp=mContext.getResources().getXml(R.color.selector_sku_btn_tv);ColorStateListcsl;try{csl=ColorStateList.createFromXml(mConte..
分类:
其他好文 时间:
2015-07-08 22:53:54
阅读次数:
142
直接上代码:类似调用方法如下:1.在XML中使用Java codeandroid:drawableLeft="@drawable/icon"2.代码中动态变化Java codeDrawable drawable= getResources().getDrawable(R.drawable.drawa...
分类:
其他好文 时间:
2015-07-08 12:18:42
阅读次数:
130
两种方法:1. tv.setTextColor(Color.parseColor("#abcdef"));2. tv.setTextColor(getResources().getColor(R.color.black));注:以下写法是错误的tv.setTextColor(R.color.black); //错误的...
分类:
移动开发 时间:
2015-07-06 17:45:49
阅读次数:
141
1.进入assets文件夹//access to the folder “assets”AssetManager am = this.getResources().getAssets(); InputStream is = am.open("plist/Exposant.plist");//read...
分类:
其他好文 时间:
2015-07-04 11:02:35
阅读次数:
114
int dip = (int) TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, 70, getResources().getDisplayMetrics());...
分类:
移动开发 时间:
2015-07-02 12:28:51
阅读次数:
1215
这个方法是转变为标准尺寸的一个函数,例如int size = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, context.getResources().getDisplayMetrics());这里COMPLEX_U...
分类:
移动开发 时间:
2015-06-28 01:13:48
阅读次数:
247
今天做一个Android文件管理器。它使用了很多当地的用途getResources。Drawable currentIcon = null; ……………… currentIcon = getResources().getDrawable(R.drawable.folder); ……………… ...
分类:
其他好文 时间:
2015-06-21 10:35:02
阅读次数:
155