原文:http://blog.csdn.net/l_serein/article/details/7061049


int[] location = new int[2] ;
view.getLocationInWindow(location); //获取在当前窗口内的绝对坐标
view.getLocationOnScreen(location);//获取在整个屏幕内的绝对坐标
location [0]--->x坐标,location [1]--->y坐标


如果在Activity的OnCreate()事件输出那些参数,是全为0,要等UI控件都加载完了才能获取到这些。
在onWindowFocusChanged(boolean hasFocus)中获取为好

更多相关文章

  1. 【原创】android中实现底部tabhost
  2. 在Android下实现鼠标右键返回
  3. Andoroid学习笔记05——Activity布局管理
  4. RatingBar的使用方法
  5. Android(安卓)开发环境下载地址
  6. listview中放Button 点击 长按事件
  7. Android(安卓)自定义字体
  8. 扩大View的点击区域
  9. android studio使用espresso做自动化测试

随机推荐

  1. Android Studio配置Android Annotations
  2. 安卓视频播放器 一行代码快速实现视频播
  3. Android 匿名共享内存C++接口分析
  4. Android中Launcher实例
  5. android 广告栏 viewpager
  6. Android Studio使用教程(一)
  7. Android之Intent(二)
  8. Android2.2 API 中文文档系列(1)
  9. Android编译系统详解(三)——编译流程详
  10. Android跨线程消息机制