Android 获取控件在整个屏幕的 X、Y及其他角度值

通过下面代码获得

                int[] location = new int[2];
                view.getLocationOnScreen(location);
                int x = location[0];
                int y = location[1];
                Log.d("tag","x:"+x+" --- y:"+y);
                Log.d("tag","图片各个角Left:"+mDeleteButton.getLeft()+"Right:"+mDeleteButton.getRight()+"Top:"+mDeleteButton.getTop()+"Bottom:"+mDeleteButton.getBottom());

猜你喜欢

转载自blog.csdn.net/qq_27494201/article/details/125196610
今日推荐