it all returns value 0 On Tue, Aug 14, 2012 at 6:19 PM, Luiz Fernando Rodrigues < [email protected]> wrote:
> Take a look in the View documentation. ( > http://developer.android.com/reference/android/view/View.html ) > getTop(), getLeft(), getRight() and getBottom() should help. > > Position > > The geometry of a view is that of a rectangle. A view has a location, > expressed as a pair of *left* and *top* coordinates, and two dimensions, > expressed as a width and a height. The unit for location and dimensions is > the pixel. > > It is possible to retrieve the location of a view by invoking the methods > getLeft()<http://developer.android.com/reference/android/view/View.html#getLeft()> > and > getTop()<http://developer.android.com/reference/android/view/View.html#getTop()>. > The former returns the left, or X, coordinate of the rectangle representing > the view. The latter returns the top, or Y, coordinate of the rectangle > representing the view. These methods both return the location of the view > relative to its parent. For instance, when getLeft() returns 20, that means > the view is located 20 pixels to the right of the left edge of its direct > parent. > > In addition, several convenience methods are offered to avoid unnecessary > computations, namely > getRight()<http://developer.android.com/reference/android/view/View.html#getRight()> > and > getBottom()<http://developer.android.com/reference/android/view/View.html#getBottom()>. > These methods return the coordinates of the right and bottom edges of the > rectangle representing the view. For instance, calling > getRight()<http://developer.android.com/reference/android/view/View.html#getRight()> > is > similar to the following computation: getLeft() + getWidth() (see > Size<http://developer.android.com/reference/android/view/View.html#SizePaddingMargins> > for > more information about the width.) > > > 2012/8/14 Vijay Krishnan <[email protected]> > >> Hi all, >> I have imageview at the center of the layout.How to find the >> position of the imageview? >> >> Thanks, >> vijay.k >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en > > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

