Suppose we want to do an effect, the top of the interface is a actionbar and is translucent, Actionbar below is a ListView, in the initial state,
The ListView is top in the bottom position of the actionbar, but when the ListView scrolls through the Actionbar you can see the following ListView
Content. As shown in the following two images:
Positive normal:
Roll Dynamic:
At first glance, it is not very simple, just set a margintop or paddingtop, but the problem is that only one of these two attributes,
The ListView can not roll to the paddingtop or margintop part of the area, some people say that it is possible to use the Headerview to solve, which is its
In one way, but only for this duty-free use of headview is a bit wasteful and will affect the position of onitemclick. So here's the introduction to this.
Effect of the two properties, is android:cliptopadding and Android:clipchildren, these two properties are not too many people use, here explain
Cliptopadding is whether the drawing area of the control is inside the padding, true if you set the padding so that the area is drawn to
Clipchildren refers to whether the child control exceeds the padding area, which is true by default, so the default setting is padding
Scrolling is within the padding, to achieve the above effect mainly set the two properties false then this way the control can be drawn to the padding area.
< ListView android:layout_gravity = "Center_vertical" android:id= "@+id/list" android:clipchildren= "false" android:cliptopadding= "false" android:paddingtop= "50dip" Android:layout_width = "Match_parent" android:layout_height= "match_parent">
Actionbar Translucent is not detailed, as long as set Actionbaroverlay to true and set a translucent background for actionbar.
This attribute RecyclerView also has, is the same meaning.
Android:cliptopadding and Android:clipchildren