Android 如何平滑listView滚动?

Android 如何平滑listView滚动?,android,android-listview,Android,Android Listview,我正在使用媒体提取器API编写媒体播放器应用程序。所以我的解码器解码数据并在表面上显示内容。这很好用。我有一个列表视图。当我滚动这个列表视图时,它会显示对解码器线程的影响。所以我受到了一些干扰。我怎样才能解决这个问题。有没有办法在单独的线程上运行我的listView适配器(getView()方法)? 我看到了这个链接。这可能对我没有帮助。 因为我的列表项只包含一个textView @Override public View getView(int position, View conve

我正在使用媒体提取器API编写媒体播放器应用程序。所以我的解码器解码数据并在表面上显示内容。这很好用。我有一个列表视图。当我滚动这个列表视图时,它会显示对解码器线程的影响。所以我受到了一些干扰。我怎样才能解决这个问题。有没有办法在单独的线程上运行我的listView适配器(getView()方法)? 我看到了这个链接。这可能对我没有帮助。 因为我的列表项只包含一个textView

@Override
    public View getView(int position, View convertView, ViewGroup parent) {
        TextView txt_Effects;
        ImageView proImage;
        if(convertView == null){
            LayoutInflater inflater= (LayoutInflater)context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
            convertView= inflater.inflate(R.layout.row_listview, null);
            txt_Effects= (TextView)convertView.findViewById(R.id.txt_row);
            proImage= (ImageView)convertView.findViewById(R.id.proImage_row);
        }
        else{
            txt_Effects= (TextView)convertView.findViewById(R.id.txt_row);
            proImage= (ImageView)convertView.findViewById(R.id.proImage_row);
        }

        txt_Effects.setText(data[position]);
        txt_Effects.setTextColor(Color.WHITE);
        proImage.setVisibility(View.GONE);

        if(position == previousSelectionIndex){
            txt_Effects.setTextColor(Color.MAGENTA);
            prevSelectedTextView= txt_Effects;
        }

        if(position>= startProIndex && position <= endProIndex){
            proImage.setVisibility(View.VISIBLE);
        }



        return convertView;
    }
@覆盖
公共视图getView(int位置、视图转换视图、视图组父视图){
文本视图txt_效果;
ImageView-proImage;
if(convertView==null){
LayoutInflater充气器=(LayoutInflater)context.getSystemService(Activity.LAYOUT\u充气器\u SERVICE);
convertView=充气机。充气(R.layout.row_listview,null);
txt_Effects=(TextView)convertView.findViewById(R.id.txt_行);
proImage=(ImageView)convertView.findViewById(R.id.proImage_行);
}
否则{
txt_Effects=(TextView)convertView.findViewById(R.id.txt_行);
proImage=(ImageView)convertView.findViewById(R.id.proImage_行);
}
txt_Effects.setText(数据[位置]);
txt_Effects.setTextColor(Color.WHITE);
proImage.setVisibility(View.GONE);
如果(位置==先前选择的索引){
txt_Effects.setTextColor(Color.MAGENTA);
prevSelectedTextView=txt\U效果;
}

如果(Stase>= StestPrimeStand & PosieP>)应该执行GeVIEW()之外的所有“重量级”操作。考虑使用AsYcTaskor或THeLoCube来进行“解码”,然后在UI线程中更新ListVIEW。< /P> < P>您应该执行GeVIEW()之外的所有“重”操作。方法。考虑使用AcyCastor或TraceCube来进行“解码”,然后在UI线程中更新ListVIEW。

< P>您可能希望使用<强> < ViewHolder > /Cux> <强>模式来提高加载列表项的性能。请参阅以下内容:


希望能有所帮助。

您可能希望使用
视图持有者
模式来提高加载列表项的性能。请参阅以下内容:


希望有帮助。

请显示您的代码。尤其是视图适配器,您可以在其中为列表创建视图。您使用的是视图持有者吗?@SMR我编辑了我的问题。@JeffreyKlardie:我编辑了我的问题。@saa:为什么我们使用视图持有者模式请查看您问题中的链接。
很有帮助请显示您的代码。特别是视图适配器,用于为列表创建视图。是否使用视图持有者?@SMR我已编辑了我的问题。@JeffreyKlardie:我已编辑了我的问题。@saa:为什么使用视图持有者模式查看此链接,您问题中的链接有帮助