androidperformanceandroid-layout

Activity performance with conditional visibility gone/visible


I have a fragment that contains a LinearLayout that is conditionally displayed or not. In terms of performance what is the best? Mark the LinearLayout as android:visibility="gone" in the XML, and then in code I set its visibility if needed, or the opposite?


Solution

  • Inflating a layout with some views with a visibility set to GONE is bad for performances, especially if the view is a bit complex.

    check url :http://magicmicky.github.io/android_development/benchmark-using-traceview/