private boolean isZh() { Locale locale = getResources().getConfiguration().locale; String language = locale.getLanguage(); if (lo...
分类:
移动开发 时间:
2014-08-13 17:56:56
阅读次数:
464
如何在Android中为TextView动态设置drawableLeft等两种方式:方式1:手动设置固有边界1 Drawable drawable = getResources().getDrawable(resId);2 //注意查看方法TextView.setCompoundDrawables(...
分类:
移动开发 时间:
2014-08-12 21:34:24
阅读次数:
379
一、从resource中的raw文件夹中获取文件并读取数据(资源文件只能读不能写)String res ="";try{InputStream in =getResources().openRawResource(R.raw.bbi);//在\Test\res\raw\bbi.txt,intleng...
分类:
移动开发 时间:
2014-08-02 04:13:06
阅读次数:
307
今天讲解一下SpannableString和ImageSpan类
Bitmap bitmap = null;
bitmap = BitmapFactory.decodeResource(getResources(), imageIds[arg2 % imageIds.length]);
ImageSpan imageSpan = new ImageSpan(NeighborCommunica...
分类:
移动开发 时间:
2014-07-26 02:45:56
阅读次数:
230
public class PxAndDp {
/**
* 根据手机的分辨率从 dp 的单位 转成为 px(像素)
*/
public static int dip2px(Context context, float dpValue) {
final float scale = context.getResources().getDisplayMetrics().density;
...
分类:
移动开发 时间:
2014-07-26 02:36:36
阅读次数:
276
获取XML文件的基本思路是,通过getResources().getXml()获的XML原始文件,得到XmlResourceParser对象,通过该对象来判断是文档的开头还是结尾,是某个标签的开始还是结尾,并通过一些获取属性的方法来遍历XML文件,从而访问XML文件的内容,下面是一个访问XML文件内...
分类:
移动开发 时间:
2014-07-26 00:37:26
阅读次数:
233
从android4.0起系统设置的”显示“提供设置字体大小的选项。这个设置直接会影响到所有sp为单位的字体适配,所以很多app在设置了系统字体后瞬间变得面目全非。下面是解决方案Resources res = getResources();Configuration config=new Config...
分类:
其他好文 时间:
2014-07-25 13:54:51
阅读次数:
6089
progressDrawable = this.getResources().getDrawable(R.drawable.image);progressDrawable.setBounds(mSeekBar.getProgressDrawable().getBounds());mSeekBar.s...
分类:
其他好文 时间:
2014-07-21 00:14:53
阅读次数:
213
获取XML文件的基本思路是,通过getResources().getXml()获的XML原始文件,得到XmlResourceParser对象,通过该对象来判断是文档的开头还是结尾,是某个标签的开始还是结尾,并通过一些获取属性的方法来遍历XML文件,从而访问XML文件的内容,下面是一个访问XML文件内...
分类:
其他好文 时间:
2014-07-19 09:15:51
阅读次数:
770
项目中,需要在代码中动态更改TextView的颜色,原先使用如下:
text.setTextColor(R.color.black);
为生效,查阅资料后,正确写法如下:
text.setTextColor(context.getResources().getColor(R.color.black));
或:
text.setTextColor(getResource...
分类:
移动开发 时间:
2014-07-19 08:16:50
阅读次数:
197