I ave created a custom view of a month tile grid that is displayed for a particular year.
it holds 12 date tiles representing each month. it looks like this:
each tile is inflated using the following 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>
it takes around 30-50ms to inflate each DateTile
when talking about a single year which is a single DateGridView
it task ~ 40*12 = 0.5 secs to inflate a single year.
I need to inflate at leas 3 pages because i use this in a page adapter that displayed the previous and next year.
is there any way to make the inflation faster or reuse the same layout to create 12 separate date tiles like this faster ?