Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hardware Accelerating in ListView

Is there a way to force hardware accelerating in a ListView. I have a ListView with more than 400 items with an icon an scrolling is very slow. Each Item has the same icon. I also added a ViewHolder. In manifest file i enabled Hardware Accelerating. An when i run this code:

ListView list_new = (ListView) findViewById(R.id.listview01);
list_new.isHardwareAccelerated();

It returns false. My phone is a Nexus S with Jelly Bean. How can i force Hardware Accelerating?

EDIT: Here is my ListView:

<ListView
    android:id="@android:id/list"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:persistentDrawingCache="scrolling"
    android:hardwareAccelerated="true"
    android:fastScrollEnabled="true" 
    android:scrollingCache="true" 
    android:smoothScrollbar="true" >
</ListView>
like image 537
alexnavratil Avatar asked Nov 13 '22 22:11

alexnavratil


1 Answers

Not all View suport hardwareAccelerated. HardwareAccelerated use for draw on Canvas. For ListView use

<ListView
...
android:smoothScrollbar="true";
...
>
like image 54
imperator_sp Avatar answered Nov 15 '22 10:11

imperator_sp