Skip to content Skip to sidebar Skip to footer

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 a TableLayout.
  • If you don't want your Buttons from tableRow00 to have equal width then you can make a small improvement and instead of your current layout, replace LinearLayout00 with a RelativeLayout, remove the tableRow00 and then place the Buttons and the ScrollView using the rules of RelativeLayout.
  • Replace LinearLayout01 with a TableLayout.
  • 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 append TableRow09 - TableRow26 to LinearLayout01.
  • The rest of my answer remains.

Post a Comment for "Enhance App Performance With More Than 80 Views On A Layout"