Enhance App Performance With More Than 80 Views On A Layout
I'm creating an android application, which has a particular screen (layout) with over (120+ views), which generates the warning: 'main.xml has more than 80 views, bad for perfor
Solution 1:
Without seeing your full layout I would say to replace that TableLayout
with a ListView
.
I'm guessing that you have a number of Views
for each row, if you switch to a ListView
you'll avoid the need to load the entire layout in memory, instead you'll load only the visible rows on the screen of the ListView
+ any views you have besides that.
With the above approach, you'll be able to remove a substantial number of rows from the current layout.
EDIT :
Based on your added layout, some advices:
TableRow
can be used as a normal view in a layout but its main purpose it to be a child of aTableLayout
.- If you don't want your
Buttons
fromtableRow00
to have equal width then you can make a small improvement and instead of your current layout, replaceLinearLayout00
with aRelativeLayout
, remove thetableRow00
and then place theButtons
and theScrollView
using the rules ofRelativeLayout
. - Replace
LinearLayout01
with aTableLayout
. - I don't know why you added the
LinearLayout02
(I'm guessing all of your rows are the same?!) but you should remove it and directly appendTableRow09
-TableRow26
toLinearLayout01
. - The rest of my answer remains.
Post a Comment for "Enhance App Performance With More Than 80 Views On A Layout"