[Solved] How to set a click in center of RelativeLayout after load Activity


  1. use gravity center in RelativeLayout and place clickable element in RelativeLayout

    <Button
        android:id="@+id/the_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Centered Button"/>
    

  2. use android:layout_centerInParent="true" in clickable element inside the RelativeLayout

    <Button
        android:id="@+id/the_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Centered Button"
        android:layout_centerInParent="true"/>
    

5

solved How to set a click in center of RelativeLayout after load Activity