【发布时间】:2017-06-28 16:39:00
【问题描述】:
假设您有一个包含 10 个LinearLayouts 的FrameLayout,其中每次只有一个可见。
每个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不会降低应用性能?
【问题讨论】:
标签: android performance android-layout leakcanary timber-android