获取应用图标,Drawable 转bitmap】的更多相关文章

获取应用图标: PackageManager p = context.getPackageManager(); Drawable draw=null; ApplicationInfo info; try { info = p.getApplicationInfo(myPackage, ); draw=info.loadIcon(p); } catch (NameNotFoundException e) { // TODO Auto-generated catch block e.printSta…
1.R-Drawable Resources resources = mContext.getResources(); Drawable drawable = resources.getDrawable(R.drawable.a); imageview.setBackground(drawable); 2.R-Bitmap Resources r = this.getContext().getResources();InputStream is = r.openRawResource(R.dra…
1. Resources resources = mContext.getResources(); Drawable drawable = resources.getDrawable(R.drawable.a); imageview.setBackground(drawable); 2. Resources r = this.getContext().getResources(); Inputstream is = r.openRawResource(R.drawable.my_backgrou…
转自http://blog.csdn.net/june5253/article/details/7826597 1.Bitmap-->Drawable Bitmap drawable2Bitmap(Drawable drawable) { if (drawable instanceof BitmapDrawable) { return ((BitmapDrawable) drawable).getBitmap(); } else if (drawable instanceof NinePatch…
Drawable                                                                                 以下这个是测试加载1000个Drawable对象的代码: public class Main extends Activity { int number = 1000; Drawable[] array; @Override public void onCreate(Bundle savedInstanceState)…
一.Bitmap转Drawable Bitmap mBitMap=getYourBitMap(); //getYourBitMap()是你获取BitMap的方法 BitmapDrawable mBitDrawable=new BitmapDrawable(mBitMap); //BtimapDrawable是Drawable的子类,直接把mBitDrawable对象当作Drawable使用即可. 二. Drawable转Bitmap Drawable mDrawable=getYourDrawa…
android在处理一写图片资源的时候,会进行一些类型的转换: 1 Drawable → Bitmap 的简单方法 ((BitmapDrawable)res.getDrawable(R.drawable.youricon)).getBitmap(); 2 Drawable → Bitmap public static Bitmap drawableToBitmap(Drawable drawable) { Bitmap bitmap = Bitmap.createBitmap(rawable.g…
Drawable                                                                                 以下这个是测试加载1000个Drawable对象的代码: public class Main extends Activity { int number = 1000; Drawable[] array; @Override public void onCreate(Bundle savedInstanceState)…
Drawable简介 Drawable是Android平下通用的图形对象,它可以装载常用格式的图像,比如GIF.PNG.JPG,当然也支持BMP.相比于View,我们并不需要去考虑如何measure.layout,仅仅只要去考虑如何draw(canavs). Though usually not visible to the application, Drawables may take a variety of forms 形式: Bitmap: the simplest Drawable,…
今天突然想到一个问题,如何去获取一个文件的关联图标呢?于是就上网搜索了一下.现总结如下: 首先明确问题:获取一个文件的关联图标或者是某个类型文件的显示图标. 在网上搜了一圈,发现方法还是比较多的,但是应用C#进行获取的方法不多.我选择一种用.Net库的方法. 使用的类: System.Drawing.Icon ,位于System.Drawing 命名空间. 具体方法: System.Drawing.Icon 类中的静态方法:public static Icon ExtractAssociated…