特定の年に表示される月タイル グリッドのカスタム ビューを作成しました。
各月を表す 12 の日付タイルを保持します。次のようになります。
各タイルは、次の XML を使用してインフレートされます。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:gravity="center_horizontal|center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/date_tile_margin"
android:layout_marginRight="@dimen/date_tile_margin"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:id="@+id/dateTile"
android:layout_height="@dimen/date_tile_height"
android:layout_width="@dimen/date_tile_width"
android:textColor="#B7BAAB"
/>
<com.endilo.views.LetterSpacingTextView
android:id="@+id/dateTileCenterLabel"
android:layout_width="@dimen/date_tile_height"
android:layout_height="@dimen/date_tile_width"
android:gravity="center_vertical|center_horizontal"
android:scaleX="0.6"
android:textSize="40sp"
android:textColor="#BCBFAF"/>
</FrameLayout>
<CheckBox
android:id="@+id/dateTileCheckbox"
android:button="@drawable/check_green"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="-20dp"
android:focusable="false"/>
<TextView
android:id="@+id/dateTileMonthLabel"
android:layout_width="wrap_content"
android:layout_marginTop="-12dp"
android:text="Jan"
android:layout_height="wrap_content"/>
</LinearLayout>
DateTile
単一の it タスクである単一の年について話す場合、それぞれを膨張させるのに約 30 ~ 50 ミリ秒かかりますDateGridView
。単一の年を膨張させるのに 40*12 = 0.5 秒かかります。前年と翌年を表示するページ アダプターでこれを使用するため、少なくとも 3 ページを膨らませる必要があります。
インフレーションを高速化する方法や、同じレイアウトを再利用してこのような 12 の個別の日付タイルを高速に作成する方法はありますか?