Requirement:
Add Pie Chart in a listView.
Approach Taken: Create a custom list Adapter and have a linearlayout which is a place holder for Pie Chart. Use achartEngine to create Pie Chart during run time and attach it to the place holder.
Problem: Now when I scroll the size of Pie Chart changes which is not desired.
Reasons could be that since listview generates the view dynamically the size available for the LinearLayout in the Custom Layout of adapter changes while scrolling and hence when I attach the pie chart view using fill_parent parameter, the size varies.
-- EDIT --
Layout for Adapter
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#A0FAF8CC"
android:orientation="horizontal"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:baselineAligned="false" >
<LinearLayout
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:orientation="vertical" >
<TextView
android:id="@+id/title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:ellipsize="end"
android:gravity="left"
android:paddingLeft="10dp"
android:text="@string/shopping"
android:textColor="@android:color/black"
android:textStyle="bold" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:gravity="left"
android:text="@string/budget"
android:paddingLeft="10dp"
android:textColor="@android:color/black" />
<TextView
android:id="@+id/allTotalTypeBudget"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="right"
android:textColor="@android:color/black"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:gravity="left"
android:paddingLeft="10dp"
android:text="@string/expense"
android:textColor="@android:color/black" />
<TextView
android:id="@+id/expenseTotalTypeBudget"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="right"
android:textColor="@android:color/black"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:gravity="left"
android:paddingLeft="10dp"
android:text="@string/remaining"
android:textColor="@android:color/black" />
<TextView
android:id="@+id/remainingTotalTypeBudget"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="right"
android:textColor="@android:color/black"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/chartView"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_weight="0.50"
android:clickable="false"
android:gravity="center" >
</LinearLayout>
</LinearLayout>