2012-11-20 2 views

Répondre

2

Utilisez View.getLocationOnScreen() et/ou getLocationInWindow(). Vous pouvez utiliser dans onWindowFocusChanged

@Override 
    public void onWindowFocusChanged(boolean hasFocus) { 
     // TODO Auto-generated method stub 
     super.onWindowFocusChanged(hasFocus); 

     int[] locationInWindow = new int[2]; 
     object.getLocationInWindow(locationInWindow); 

     Log.v("TAG","getLocationInWindow() - "+ locationInWindow[0] + " : " + locationInWindow[1]); 
    } 
+0

Quand faut-il appeler ces méthodes? J'ai essayé de les appeler depuis onCreate mais ils retournent 0 ( –

Questions connexes