假设您有一个FrameLayout
包含10个LinearLayouts
,其中每个时间只有一个可见。可能会改变太多布局的可见性是一个性能问题?
每个LinearLayout
是一个复杂的视图,其中包含Button
,EditText
,TextView
等
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/alice
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible">
<!-- complex stuff -->
</LinearLayout>
<!-- many more linear layouts... -->
<LinearLayout
android:id="@+id/juliett
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<!-- last complex stuff -->
</LinearLayout>
</FrameLayout>
因此:
- 改变
LinearLayout
能见度,为了显示的另一个项目,将是一个巨大的性能问题? - 鉴于这是一个问题,为什么使用
ViewFlipper
不会降低应用性能?
onLayout','onMeasure','onRequestFocusInDescendants','onDraw'方法仅在被设置为“View.VISIBLE”的视图上调用(在该序列上),而不是在View中的视图。 GONE'。我知道'Fragment'或'ViewFlipper'是一个_cleaner_解决方案,但我也怀疑是否存在_performance问题_。 –