首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

Launcher中取得桌面所有图标的左下角坐标

2012-09-08 
Launcher中取得桌面所有图标的左上角坐标/*** 取得所有桌面图标的左上角坐标值* @ author: 叶里的猫*@retu

Launcher中取得桌面所有图标的左上角坐标

/**     * 取得所有桌面图标的左上角坐标值      * @ author: 叶里的猫     *@return 返回坐标数组     */    public int [][] getAllChildCoordinate(){        int size = this.getChildCount() ;        int [][] coordinates = new int [size][2];                      for(int i=0;i<size;i++){           View child = this.getChildAt(i);           if(child instanceof BubbleTextView){                              BubbleTextView btv = (BubbleTextView)child ;               //横坐标               int left = btv.getLeft() ;               //纵坐标               int top = btv.getTop() ;               coordinates[i][0] = left ;               coordinates[i][1] = top ;                                      }        }                return coordinates ;    }


其中的图标区域是指包括橙色背景的区域,也就是说BubbleTextView组件的范围为:padding+图片

热点排行