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.
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.
In relative layout or in any view group, if we use so many attributes to position our view like:
android:layout_alignTop
, android:layout_alignBottom
etc.
In those attributes, we provide a view's id to align our view. Like:
android:layout_alignBottom="@+id/add_btn"
So, this given view is called as Anchor View. Here view with id addBtnView
is our Anchor View.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With