How can i get the position of an button with centerInParent

<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:p1="http://schemas.android.com/apk/res/android" p1:minWidth="25px" p1:minHeight="25px" p1:layout_width="match_parent" p1:layout_height="match_parent" p1:id="@+id/absoluteLayout1"> <Button p1:layout_width="101.5dp" p1:id="@+id/Start" p1:text="@string/StartBtn" p1:layout_height="101.5dp" p1:layout_centerInParent="true" /> <WebView p1:layout_centerInParent="true" p1:layout_height="match_parent" p1:layout_width="match_parent" p1:id="@+id/Sky" /> </RelativeLayout>

So i have that for example and i would want to get the x/y coords of the button. How can i do it? Or the height of the container so i can calculate it. Resources.DisplayMetrics.HeightPixels is not usefull as it returns the size of the screen.

Sign In or Register to comment.