在Android中,有没有比Gallery小部件更快的替代方法,因为Gallery是如此缓慢且滞后,所以我尝试使用视图持有器重用视图,但没有结果。我用经典的方法

public View getView(int position, View convertView, ViewGroup parent) {


        ViewHolder holder;
         if (convertView == null) {
                convertView = mInflater.inflate(R.layout.image, null);

                // Creates a ViewHolder and store references to the two children views
                // we want to bind data to.
                holder = new ViewHolder();

                holder.icon = (ImageView) convertView.findViewById(R.id.ImageView01);

                convertView.setTag(holder);
         } else {
                // Get the ViewHolder back to get fast access to the TextView
                // and the ImageView.
                holder = (ViewHolder) convertView.getTag();
            }
         holder.icon.setImageDrawable(getPicture(items[position]));
         return convertView;

         }

最佳答案

这是其他人创建并上传到GitHub的几个画廊。您可能需要签出它们,以查看它们的状态和速度。

10-08 11:57