该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
我不用include直接在xml中写全部控件,相当于用一次include还感觉不到延迟,而如果用include引用一次就会感到明显的跳转延迟,多引用几次延迟更是多达好几秒。
这是我的引用xml:
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/yangpizhi"
android:padding="3dp">
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/imageView"
android:background="@drawable/card_bg_3_0"
android:padding="3dp" />
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/imageView3"
android:background="@drawable/card_bg_3_0"
android:padding="3dp"
android:layout_alignParentRight="true" />
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/imageView2"
android:background="@drawable/card_bg_3_0"
android:padding="3dp"
android:layout_toLeftOf="@id/imageView3" />
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:id="@+id/layout2"
android:layout_toRightOf="@id/imageView"
android:layout_toLeftOf="@id/imageView2"
>
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:weightSum="4">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="最小:"
android:id="@+id/textView"
/>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:id="@+id/textView2" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="最大:"
android:id="@+id/textView3" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:id="@+id/textView4" />
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="30dp"
>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="@+id/textView5" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Medium Text"
android:id="@+id/textView6" />
其实并不复杂,就是几个控件和几个嵌套的布局,而且使用include不是应该效率提高吗?为什么反而更慢了?
如果全部放到界面xml里写,几个相同的加起来控件太多了。。。