zoukankan      html  css  js  c++  java
  • Android进阶篇截屏操作

        /**截屏操作
         * 
         * 把图片保存到SD卡
         */
        private void ScreenShot(View v,String fileName){
            View view = v.getRootView();
            view.setDrawingCacheEnabled(true);
            Bitmap bitmap = view.getDrawingCache();
            
            FileOutputStream fos = null;
            File dirFile = new File(DIRPATH);
            
            if(!dirFile.exists()){
                dirFile.mkdir();
            }
            
            try {
                fos = new FileOutputStream(new File(DIRPATH + FILENAME));
                if (null != fos) {
                    bitmap.compress(Bitmap.CompressFormat.PNG, 90, fos);
                    fos.flush();
                    fos.close();
                }
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    截屏操作二:

        public static void screenView(View view,String fileName){
            Bitmap sCoverBitmap = Bitmap.createBitmap(
                    view.getWidth(),view.getHeight(), Config.ARGB_8888);
            Canvas canvas = new Canvas(sCoverBitmap);
            view.draw(canvas);
            
            FileOutputStream fos = null;
            File dirFile = new File(StaticData.PATH);
            
            if(!dirFile.exists()){
                dirFile.mkdir();
            }
            
            try {
                File file = new File(StaticData.PATH,fileName);
                fos = new FileOutputStream(file);
                if (null != fos) {
                    sCoverBitmap.compress(Bitmap.CompressFormat.PNG, 90, fos);
                    fos.flush();
                    fos.close();
                }
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
  • 相关阅读:
    (转) hive调优(2)
    (转)hive调优(1) coding调优
    hive on tez 错误记录
    tez 0.9.0 配置
    hive on tez
    让博客园自动生成目录
    hive --metastore三种模式
    hive 使用beelin连接报错
    mysql my.cnf文件
    1、Kfaka 部署
  • 原文地址:https://www.cnblogs.com/gongcb/p/2633648.html
Copyright © 2011-2022 走看看