Avijit Karmakar Avijit Karmakar - 1 month ago 13
Android Question

Anchor View in Android

I saw a reference about Anchor View in Android. If possible please provide an example with the explanation. I think it's related to some view group.

Answer Source

Anchor View can be easily understood with the help of example below

<ImageView
        android:id="@+id/value_animator_subjectb"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:srcCompat="?android:attr/textSelectHandle"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="190dp"
        android:layout_alignLeft="@+id/xyz_button" />

the ImageView is going to align its left edge with the left edge of view with id xyz_button so, in this case, view with id xyz_button is anchor view.