This article takes you to realize the rounded distribution of the ListView, the principle is very easy, that is, each item is offset according to the height of each item of the ListView.
First define a linearlayout, which is the root layout of each item in the ListView, which is used to offset each item.
The following code:
public class Matrixlinearlayout extends LinearLayout {private int h = 0; private float Fulltrans = 40f; Public MatrixView (context context, AttributeSet Attrs) {Super (context, attrs); } public void Setparentheight (int height) {<pre name= "code" class= "Java" >//Incoming ListView height H = heigh T } @Override protected void Dispatchdraw (canvas canvas) {canvas.save (); int top = GETTOP (); Float trans = Calculatetrans (top,h); Matrix m = Canvas.getmatrix (); M.pretranslate ( -2/getwidth (), -2/getheight ()); M.posttranslate (trans, 0); Canvas.concat (m); Super.dispatchdraw (canvas); Canvas.restore (); } @Override protected void onmeasure (int widthmeasurespec, int heightmeasurespec) {super.onmeasure (widthmeas Urespec, Heightmeasurespec); } private float Calculatetrans (int top,int h) {float result = 0f; if (top <= h/2.349f) {result = (H/2f-top)/(h/7f) *fulltrans; }else if (Top > h/2.349f) {result = (top-h/3f)/(h/7f) *fulltrans; } return result; }}
The following people can write their own demo test, is to write a ListView, and then use the above-defined matrixlinearlayout as the ListView item's root layout, self-clothed!
Android Round-Arc ListView Implementation