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

[ad_1]

  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

[ad_2]

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