View.getLocationInWindow(int[] location)
一個控件在其父窗口中的座標位置
View.getLocationOnScreen(int[] location)
一個控件在其整個屏幕上的座標位置
start = (Button) findViewById(R.id.start);
int []location=new int[2];
start.getLocationOnScreen(location);
int x=location[0];//獲取當前位置的橫座標
int y=location[1];//獲取當前位置的縱座標