Scrollview is extremely slow on ics (android 4.0) when it contains long text

Here is my problem, I am developing a news app, and I used scrollview, wrapping a text image to show the content of the news. But I found that scrolling is extremely slow on android 4.0 ics, when the text is quite long, and the longer the text, the slower the scrolling. While on Android 2.3 devices, everything is going as fast as expected.

I don't know if this is really a system error, I found this similar problem reported in android project

Here is my layout:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <ScrollView android:id="@id/lst_news_details" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/list_background" android:fadingEdge="none" android:gravity="center" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:layout_marginLeft="15dp" android:layout_marginRight="15dp" android:layout_marginTop="10dp" android:orientation="vertical" > <TextView android:id="@id/tv_news_details_title" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/Detail_Title"/> <TextView android:id="@id/tv_news_details_category" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/Detail_Category"/> <TextView android:id="@id/tv_news_details_created_at" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="10dp" style="@style/Detail_Time"/> <include layout="@layout/detail_horizontal_divideline" /> <ImageView android:id="@id/img_news_details_image" style="@style/Detail_Picture" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="6dp" android:layout_gravity="center_horizontal" android:contentDescription="@string/image_contentDescription"/> <TextView android:id="@id/tv_news_details_context" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:layout_gravity="center_horizontal" style="@style/Detail_Content"/> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="10dip" /> </LinearLayout> </ScrollView> <!-- actionbar shadow --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/action_bar_shadow" > </LinearLayout> </FrameLayout> 

And my style.xml

 <style name="Detail_Title"> <item name="android:textColor">@color/list_item_title</item> <item name="android:textSize">18sp</item> <item name="android:shadowColor">@color/list_item_text_shadow</item> <item name="android:shadowDx">0</item> <item name="android:shadowDy">2</item> <item name="android:shadowRadius">2</item> </style> <style name="Detail_Category"> <item name="android:textColor">@color/list_item_category</item> <item name="android:textSize">14sp</item> <item name="android:shadowColor">@color/list_item_text_shadow</item> <item name="android:shadowDx">0</item> <item name="android:shadowDy">2</item> <item name="android:shadowRadius">2</item> </style> <style name="Detail_Time"> <item name="android:textColor">@color/list_item_time</item> <item name="android:textSize">14sp</item> <item name="android:shadowColor">@color/list_item_text_shadow</item> <item name="android:shadowDx">0</item> <item name="android:shadowDy">2</item> <item name="android:shadowRadius">2</item> </style> <style name="Detail_Content"> <item name="android:textColor">@color/detail_content_text</item> <item name="android:textSize">16sp</item> <item name="android:autoLink">all</item> <item name="android:shadowColor">@color/list_item_text_shadow</item> <item name="android:shadowDx">0</item> <item name="android:shadowDy">2</item> <item name="android:shadowRadius">2</item> </style> <style name="Detail_Picture"> <item name="android:layout_gravity">center</item> <item name="android:gravity">center</item> <item name="android:background">@drawable/image_frame</item> </style> 

By the way, I already installed

android:minSdkVersion="7" android:targetSdkVersion="14"

But don't set the hardware acceleration flag yet.

Is there any solution? Please help me, thanks!

+4
android textview scrollview
Aug 24 2018-12-12T00:
source share
2 answers

Well, I found a solution myself

just set android:hardwareAccelerated="false" in manifest.xml

Still pretty confused about the reason, awaiting an explanation.

+10
Aug 25 '12 at 3:00
source share

Note that you can add android:hardwareAccelerated="false" for a specific activity (or even a certain kind), as shown here: http://developer.android.com/guide/topics/graphics/hardware-accel.html , if you want the rest of your application to be accelerated.

+4
Jan 07 '13 at 3:39
source share



All Articles