我明白你的意思,如果我用canvas重画这样图,那么标注的点击事件,就没有办法添加?
有没有更理想的办法?

解决方案 »

  1.   

    给你一个计算bitmap的算法
     /**
         * bitmap算法
         */
        public static int computeSampleSize(BitmapFactory.Options options,
                int minSideLength, int maxNumOfPixels) {
            int initialSize = computeInitialSampleSize(options, minSideLength,
                    maxNumOfPixels);
         
            int roundedSize;
            if (initialSize <= 8) {
                roundedSize = 1;
                while (roundedSize < initialSize) {
                    roundedSize <<= 1;
                }
            } else {
                roundedSize = (initialSize + 7) / 8 * 8;
            }
         
            return roundedSize;
        }
         
        private static int computeInitialSampleSize(BitmapFactory.Options options,
                int minSideLength, int maxNumOfPixels) {
            double w = options.outWidth;
            double h = options.outHeight;
         
            int lowerBound = (maxNumOfPixels == -1) ? 1 :
                    (int) Math.ceil(Math.sqrt(w * h / maxNumOfPixels));
            int upperBound = (minSideLength == -1) ? 128 :
                    (int) Math.min(Math.floor(w / minSideLength),
                    Math.floor(h / minSideLength));
         
            if (upperBound < lowerBound) {
                // return the larger one when there is no overlapping zone.
                return lowerBound;
            }
         
            if ((maxNumOfPixels == -1) &&
                    (minSideLength == -1)) {
                return 1;
            } else if (minSideLength == -1) {
                return lowerBound;
            } else {
                return upperBound;
            }
        } 然后这样用InputStream is =  this.getResources().openRawResource(R.drawable.map2);
    BitmapFactory.Options option = new BitmapFactory.Options();

    option.inSampleSize = computeSampleSize(option, -1, 1909*2089);
    option.inJustDecodeBounds = false;
    bitmap = BitmapFactory.decodeStream(is,null,option);
    可以避免内存溢出
      

  2.   

    想学习自定义地图 求楼主分享Demo
      

  3.   

    非常希望楼主能分享自定义地图以及位置定位的DEMO,不胜感激!!!
      

  4.   

    求楼主分享自定义地图以及位置定位的demo,非常感谢!!