滚动型是集成电路(Android 4.0版本)包含一个时长的TextView缓慢的极端 [英] scrollview is extremly slow on ics (android 4.0) when containing a long textview

查看:101
本文介绍了滚动型是集成电路(Android 4.0版本)包含一个时长的TextView缓慢的极端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的问题,我正在开发一个新闻应用程序了,我用滚动型包装一个TextView来显示新闻内容。
但我发现,滚动上的极端Android 4.0的芯片速度慢,当TextView的很长,文本越长,越慢滚动。而在Android 2.3设备如预期的东西只是去一样快。

Here's my problem, i'm developing a news applicaiton and i used scrollview wrapping a textview to show the content of the news. But i found that scrolling is extremly slow on android 4.0 ics when the textview is quite long, and the longer the text, the slower the scrolling is. While on android 2.3 devices things just go as fast as expected.

我不知道这是否真的是一个系统漏洞,因为我发现这个的报道了Android项目类似的问题。

I don't know whether this is really a system bug cause i found this similar problems reported on the android project

下面是我的布局:

<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>

和我style.xml

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've already set

安卓的minSdkVersion =7
的android:targetSdkVersion =14

但尚未设置硬件加速的标志呢。

But haven't set the hardware accelerated flag yet.

请问有什么解决办法吗?请帮帮我,谢谢!

Is there any solution? Please help me, thanks!

推荐答案

唉,我发现我自己的解决方案。

Well, i've found the solution on my own

刚刚成立的android:hardwareAccelerated =FALSE在manifest.xml

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

还是相当困惑的原因,等待一个解释。

Still quite confused about the reason, waiting for an explanation.

这篇关于滚动型是集成电路(Android 4.0版本)包含一个时长的TextView缓慢的极端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆