Java Code Examples for android.widget.ImageView.getGlobalVisibleRect()

The following are Jave code examples for showing how to use getGlobalVisibleRect() of the android.widget.ImageView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: ZoomPreviewPicture   File: RecycleViewActivity.java   View Source Code Vote up 6 votes
/**
 * 查找信息
 * 从第一个完整可见item逆序遍历,如果初始位置为0,则不执行方法内循环
 */
private void computeBoundsBackward(int firstCompletelyVisiblePos) {
    for (int i = firstCompletelyVisiblePos;i < mThumbViewInfoList.size(); i++) {
        View itemView = mGridLayoutManager.findViewByPosition(i);
        Rect bounds = new Rect();
        if (itemView != null) {
            ImageView thumbView = (ImageView) itemView.findViewById(R.id.iv);
            thumbView.getGlobalVisibleRect(bounds);
        }
        mThumbViewInfoList.get(i).setBounds(bounds);
    }
}
 
Example 2
Project: ZoomPreviewPicture   File: ListView2Activity.java   View Source Code Vote up 6 votes
/**
 * 查找信息
 * 从第一个完整可见item逆序遍历,如果初始位置为0,则不执行方法内循环
 */
private void computeBoundsBackward(int firstCompletelyVisiblePos) {
    for (int i = firstCompletelyVisiblePos;i < mThumbViewInfoList.size(); i++) {
        View itemView = listView.getChildAt(i-firstCompletelyVisiblePos);
        Rect bounds = new Rect();
        if (itemView != null) {
            ImageView thumbView = (ImageView) itemView.findViewById(R.id.iv);
            thumbView.getGlobalVisibleRect(bounds);
        }
        mThumbViewInfoList.get(i).setBounds(bounds);
    }
}
 
Example 3
Project: ZoomPreviewPicture   File: GridView2Activity.java   View Source Code Vote up 6 votes
/**
 * 查找信息
 * 从第一个完整可见item逆序遍历,如果初始位置为0,则不执行方法内循环
 */
private void computeBoundsBackward(int firstCompletelyVisiblePos) {
    for (int i = firstCompletelyVisiblePos; i < mThumbViewInfoList.size(); i++) {
        View itemView = listView.getChildAt(i - firstCompletelyVisiblePos);
        Rect bounds = new Rect();
        if (itemView != null) {
            ImageView thumbView = (ImageView) itemView.findViewById(R.id.iv);
            thumbView.getGlobalVisibleRect(bounds);
        }
        mThumbViewInfoList.get(i).setBounds(bounds);
    }
}
 
Example 4
Project: ZoomPreviewPicture   File: PostAdapter.java   View Source Code Vote up 6 votes
/**
 * 查找信息
 * @param list 图片集合
 */
private void computeBoundsBackward(List<UserViewInfo> list) {
    for (int i = 0;i < mNglContent.getChildCount(); i++) {
        View itemView = mNglContent.getChildAt(i);
        Rect bounds = new Rect();
        if (itemView != null) {
            ImageView thumbView = (ImageView) itemView;
            thumbView.getGlobalVisibleRect(bounds);
        }
        list.get(i).setBounds(bounds);
        list.get(i).setUrl(list.get(i).getUrl());
    }

}
 
Example 5
Project: ZoomPreviewPicture   File: GridViewCustomActivity.java   View Source Code Vote up 6 votes
/**
 * 查找信息
 * 从第一个完整可见item逆序遍历,如果初始位置为0,则不执行方法内循环
 */
private void computeBoundsBackward(int firstCompletelyVisiblePos) {
    for (int i = firstCompletelyVisiblePos; i < mThumbViewInfoList.size(); i++) {
        View itemView = listView.getChildAt(i - firstCompletelyVisiblePos);
        Rect bounds = new Rect();
        if (itemView != null) {
            //需要显示过度控件
            ImageView thumbView = (ImageView) itemView.findViewById(R.id.iv);
            //拿到在控件屏幕可见中控件显示为矩形Rect信息
            thumbView.getGlobalVisibleRect(bounds);
        }
        mThumbViewInfoList.get(i).setBounds(bounds);
    }
}