Hi, please review the CL. Thank you :D
app:layout_goneMarginTop="@dimen/ntp_logo_margin_bottom"app:layout_goneMarginTop="@dimen/ntp_logo_margin_bottom" means that if the top anchor view (search_box_container) is GONE, the ntp_logo_margin_bottom is applied.
shape.setColor(Color.WHITE);The background color cannot be modified within the existing XML. We must create a copy of home_surface_search_box_background.xml to apply the new color, if we don't set the color directly here in the java code. The android:backgroundTint attribute in xml won't apply the pure white color that we want.
marginParams.topMargin = marginPx;The top margin of the search box is updated here instead of the bottom margin of the logo view because the search box is constrained to the bottom of the logo.
In a ConstraintLayout, a bottom margin only creates a gap if the view is also constrained at its bottom to a subsequent element; otherwise, it is ignored.
We cannot reverse this constraint (i.e., anchoring the logo to the search box) because the logo may be GONE for certain search engines. If the logo were the anchor for the search box and then disappeared, the search box would lose its top anchor. By constraining the search box to the logo, the search box can 'pull through' the logo when it is hidden, automatically anchoring itself to the guideline above and preserving the layout integrity.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |