2014年1月2日星期四

[Android] linearlayout RelativeLayout performance comparison

If it is simple . Layout. Several textview placed vertically on the screen ,
kind of performance will be faster ?
I did a test
LinearLayout
calculation : 0.738ms
painting : 7.655ms

RelativeLayout
calculation : 2.280ms
painting : 7.696ms

because the layout is simple .. I did not add any properties. marginLeft when I added the property after . then compare the two layouts


linearlayout painting with a 6.529ms
The RelativeLayout with a 9.919ms

I did not do too much performance comparison.

but this simple test , and I like the idea itself .
linearlayout after all, does not do much overall calculations. matter behind , just your own Unless added weight , but the weight calculation is not too large.
The RelativeLayout too strong. too many things to take care of it.
Of course, you might say that the layout is definitely more accelerated without measurement know .
but we use the most common layout test it ..
If you think my test is ambiguous or incorrect. raised , we learn next .

------ Solution ------------------------------------ --------
sense that framelayout should be faster , do not have to calculate where to start painting
------ Solution ------------- -------------------------------
and I think as a result , there is now a basis in fact
- ----- eference ---------------------------------------
Oh ~ ~ ~ Thanks for testing ! ! !
------ eference --------------------------------------- < br> try adding weight

没有评论:

发表评论