在 Android 中是否有比 Gallery 小部件更快的替代品,因为 Gallery 是如此缓慢和滞后,我尝试使用 view holder 来重用 View ,但没有结果。我用的是经典方法
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 的几个不同的画廊.您可能需要检查它们以了解它们的性能和速度。
关于android - 画廊小部件的替代品,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7818753/