0
所有布局我有很多的* .xml布局项ViewFlipper(108是精确的)我的活动布局内的问题是,当我启动应用程序,所有的布局中ViewFlipper被分配。的Android ViewFlipper - 防止分配内部ViewFlipper
有没有办法阻止在启动时分配所有ViewFlipper项目,并只在viewflipper项目被加载时才分配它?
我main_activity.xml代码
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffececec"
tools:context=".MyActivity">
<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/flipper"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<include android:id="@+id/pageMainWin" layout="@layout/main_win" />
// Other ViewFlipper items
</ViewFlipper>
</RelativeLayout>
为什么你有108个布局项目? – ianhanniballake 2014-10-10 20:32:54
你可以在主版面项目主要设置为'layout.setVisiblity(View.GONE)'趁其不使用,然后提供一个'View.VISIBLE'当你再次需要它,如果你真的需要。这将不会消耗资源,直到他们需要。比如当你向左或向右平移时。 – 2014-10-10 20:35:21