List View scroll slow when setting background image
<p>In my app i have <code>ListView</code> which is placed inside an <code>LinearLayout</code>, My problem is that if i set background image to this layout like <code>android:background="@drawable/theme1_bg_page_view"</code> then the scrolling of my <code>ListView</code> become slow, but if i set background color instead of image like <code>android:background="#808080"</code> the its scrolling become fast. Why this happen, means simply putting the background image can make the <code>ListView</code> slow. How can i solve this issue</p>

<p><strong>code for xml layout</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_all_page"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/theme1_bg_page_view"
android:orientation="vertical" &gt;

&lt;LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginRight="10dp"
    android:layout_marginTop="10dp"
    android:gravity="right"
    android:orientation="horizontal" &gt;

    &lt;Button
        android:id="@+id/but_add"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/bg_button_add"
        android:text="@string/but_add_text"
        android:textColor="#4F4F4F"
        android:textSize="30dp" &gt;
    &lt;/Button&gt;
&lt;/LinearLayout&gt;

&lt;in.com.juswrite.DragNDropListView
    android:id="@+id/android:list"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_marginTop="5dp"
    android:cacheColorHint="#00000000"
    android:listSelector="#00000000" &gt;
&lt;/in.com.juswrite.DragNDropListView&gt;
</code></pre>

<p></p>

<p><strong>Java Code</strong></p>

<pre><code>public class ListViewAdapter extends BaseAdapter
{
private Activity activity;
private  ArrayList&lt;String&gt; listItem;
private LayoutInflater inflater=null;
public ImageLoader imageLoader; 

public ListViewAdapter(Activity a,  ArrayList&lt;String&gt; d)
{
    activity = a;
    listItem = d;
    inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    imageLoader=new ImageLoader(activity.getApplicationContext());
}

public int getCount()
{
    return listItem.size();
}

public Object getItem(int position)
{
    return position;
}

public long getItemId(int position)
{
    return position;
}

public class ViewHolder
{
    Button butDelete;
    ImageView image;
}

public View getView(final int position, View convertView, ViewGroup parent)
{
    ViewHolder holder;

    if(convertView == null)
    {
        holder = new ViewHolder();
        convertView = inflater.inflate(R.layout.list_item, null);
        holder.butDelete = (Button)convertView.findViewById(R.id.but_delete);
        holder.image = (ImageView)convertView.findViewById(R.id.image);
        convertView.setTag(holder);
    }
    else
    {
        holder = (ViewHolder)convertView.getTag();
    }

    m_face = Typeface.createFromAsset(getAssets(), "fonts/Cicle Semi.ttf");
    holder.butDelete.setTypeface(m_face);
    holder.butDelete.setOnClickListener(new OnClickListener()
    {
        @Override
        public void onClick(View v)
        {
            EXTRA_IMAGE_NAME = listItem.get(position);
            File file = new File(DEFAULT_APP_IMAGEDATA_DIRECTORY + EXTRA_IMAGE_NAME);
            file.delete();
            displayListView();
        }
    });

    imageLoader.DisplayImage(DEFAULT_APP_IMAGEDATA_DIRECTORY + listItem.get(position), holder.image);
    holder.image.setOnClickListener(new OnClickListener()
    {
        @Override
        public void onClick(View v)
        {
            EXTRA_IMAGE_NAME = listItem.get(position);
            displayCanvasDialog();
        }
    });

    return convertView;
}

}
</code></pre>
